all: lua jacorb tomcat ganglia
lua: FORCE
	cd lua && tar zxf oilpack-src.tar.gz
	cd lua/oilpack && ./install.sh > /tmp/log/deps-`hostname`.log
	#export CPATH=`pwd`/readline/readline-5.2/rd-built/include:`pwd`/ncurses/ncurses-5.7/nc-built/include && export LIBRARY_PATH=`pwd`/readline/readline-5.2/rd-built/lib:`pwd`/ncurses/ncurses-5.7/nc-built/lib && cd lua/oilpack && ./install.sh > /tmp/log/deps-`hostname`.log
	mv lua/oilpack/lua-built lua/lua-built

luaclean:
	rm -Rf lua/lua-built
	rm -Rf lua/oilpack

ant: FORCE
	cd ant && tar zxf apache-ant-1.7.0-bin.tar.gz
	mv ant/apache-ant-1.7.0 ant/ant-built 

antclean:
	rm -Rf ant/ant-built

tomcat: FORCE
	cd tomcat && tar zxf apache-tomcat-5.5.23.tar.gz
	mv tomcat/apache-tomcat-5.5.23 tomcat/tomcat-built

tomcatclean:
	rm -Rf tomcat/tomcat-built

ganglia: FORCE
	#cd ganglia && tar xf ganglia-3.1.2.tar.gz
	#cd ganglia/ganglia-3.1.2 && ./configure --with-gmetad --prefix=`pwd`/ganglia/ganglia-built
	#cd ganglia/ganglia-3.1.2 && make && make install
	#rm -Rf ganglia/ganglia-3.1.2
	#  ARRUMAR VARIAVEL do gmetad.conf ##########################
	# cp ganglia/*.conf ganglia/ganglia-built 

gangliaclean: 
	# rm -Rf ganglia/ganglia-built

jacorb: ant FORCE
	cd jacorb && tar zxf JacORB-2.2.3-source.tar.gz 
	cd jacorb/JacORB-2.2.3 && export ANT_OPTS=-Xmx640m &&../../ant/ant-built/bin/ant > /tmp/log/deps-`hostname`.log
	mv jacorb/JacORB-2.2.3 jacorb/jacorb-built

jacorbclean:
	rm -Rf jacorb/jacorb-built

openssl: FORCE
	cd openssl && tar zxf openssl-0.9.8h.tar.gz 
	cd openssl/openssl-0.9.8h && ./config > /tmp/log/deps-`hostname`.log
	cd openssl/openssl-0.9.8h && make > /tmp/log/deps-`hostname`.log

opensslclean:
	rm -Rf openssl/openssl-0.9.8h

readline: FORCE
	mkdir readline/readline-5.2/rd-built
	cd readline/readline-5.2 && ./configure  > /tmp/log/deps-`hostname`.log
	cd readline/readline-5.2 && make && make install DESTDIR=`pwd`
	mv readline/readline-5.2/usr/local/* readline/readline-5.2/rd-built 

readlineclean: 
	rm -Rf readline/readline-5.2/rd-built

ncurses: FORCE
	mkdir ncurses/ncurses-5.7/nc-built
	cd ncurses/ncurses-5.7/ && ./configure  > /tmp/log/deps-`hostname`.log
	cd ncurses/ncurses-5.7/ && make && make install DESTDIR=`pwd`
	mv ncurses/ncurses-5.7/usr/* ncurses/ncurses-5.7/nc-built

ncursesclean: 
	rm -Rf ncurses/ncurses-5.7/nc-built

clean: readlineclean luaclean antclean jacorbclean opensslclean ncursesclean tomcatclean gangliaclean

FORCE:
