Hi, Here is a patch a wrote so you can use "mmake" with SourceNavigator. When you press the "make" button in SN, it will give the filename to the make command, and this may be a problem , especially when you have your sources in a directory structure that reflects the packages. Just put this script in one of your "bin" directories and run it instead of "mmake" to create your Makefile. Catalin. Ramesh Babu A. wrote: > Hi, > > How to write MakeFile for Java in Linux ? > > Here I have snippet of makefile code. But it does not > > working properply (When I each time give cmd like > > make -f MakeFile, it compiles each java files even it's > > time is not modified.) > > If anybody know mail to me. > > > Regards, > > Ramesha > > > -------------------- > > MakeFile > > ------------------- > > > #************************************************************************** > # > # Makefile for JAVA GUI > # > # Author : Ramesh .A Babu, TeneT Group, 4078,, > # > # > # Change Log: <Date> <Author> > # <Changes> > # > #*************************************************************************/ > > CLASSES = Status.class FirstDemo.class UserPortMgr.class RTMgr.class \ > SecondLevelMgr.class Tester.class UpdateInterface.class \ > FileViewer.class FillUtils.class FillNetwork.class \ > UserPort.class CodeDownLoad.class \ > LineCard.class MntcPkt.class PostTest.class > > > > > all: $(CLASSES) > > # ****************** Directory Path for JFC compiler ************************ > > JAVAC = /usr/local/jdk116/bin/ > > # ***************** Java files to be compile *************************** > > > # Single dependent java files > > UpdateInterface.class: UpdateInterface.java > $(JAVAC) UpdateInterface.java > > FileViewer.class: FileViewer.java > $(JAVAC) FileViewer.java > > FillUtils.class: FillUtils.java > $(JAVAC) FillUtils.java > > FillNetwork.class: FillNetwork.java > $(JAVAC) FillNetwork.java > > LineCard.class: LineCard.java > $(JAVAC) LineCard.java > > MntcPkt.class: MntcPkt.java > $(JAVAC) MntcPkt.java > > PostTest.class: PostTest.java > $(JAVAC) PostTest.java > > UserPortMgr.class: UserPortMgr.java > $(JAVAC) UserPortMgr.java > > RTMgr.class: RTMgr.java UserPortMgr.java > $(JAVAC) RTMgr.java > > SecondLevelMgr.class: SecondLevelMgr.java > $(JAVAC) SecondLevelMgr.java > > Status.class: Status.class MntcPkt.java > $(JAVAC) Status.java > > # *********************** Clean unwanted files ************************* > > clean: > rm -f *.*~ core *~ > > > # ************************ End of Makefile ****************************** > >
f_rec () { if [ "$1" = "" ] then pattern=* else pattern=$1/* fi for fn in $pattern do case $fn in *.java) echo `basename $fn`: echo " \$(JAVAC) \$(JAVAC_FLAGS) " $fn echo ;; *) if [ -d $fn ] then f_rec $fn fi ;; esac done } mmake if [ -f Makefile ] then line=`cat Makefile | grep -n "# Build Rules" | cut -f 1 -d :` line=`expr $line + 2` head Makefile -n $line > Makefile.new echo "# mmake patch: insert each java target" >> Makefile.new f_rec $1 >> Makefile.new echo "# mmake patch ends here" >> Makefile.new tail Makefile -n +$line >> Makefile.new rm Makefile mv Makefile.new Makefile fi