(no subject)
Вот итог изучения makefileов: makefile для компиляции жаба-проекта:
Какие-нибудь предложения, идеи?
#JSDK options:
#Where's the compiler
JAVADIR=/usr/local/j2sdk1.4.1_02
#How to call the compiler
CMP=$(JAVADIR)/bin/javac
#Project options
#Where's the project
PROJDIR=.
#What to include
INC=/mnt/prj/java/ftp-1.2.3/ftp.jar
#Where to put the result
DST=-d $(PROJDIR)/classes
#What is the resulting classpath
CPT=-classpath .:/home/pechkin/prj/classes:$(INC):$(JAVADIR)/lib/tools.jar
#How to compile
OPT=-deprecation #-verbose
#make variables
SHELL=/bin/bash
.PHONY: sources compileall
include sources.lst
compileall: sources.lst
$(CMP) $(SRC) $(CPT) $(OPT) $(DST)
#Чего-нибудь навроде тирьям-тирьям-тирьям:
# for srcfile in `cat sources.lst` do;
# cat $$srcfile | awk ‘BEGIN {$$srcfile”.class: \\” /^import (.*);$/ {print $1”\\”}’ END {print “\t$(CMP) $^ $(CPT) $(OPT) $(DST)”}’ >$$srcfile.makefile #, короче, достать импорты и проверить, что такие файлы есть внутри проекта
# done;
cp sources.lst _sources.lst
rm sources.lst
#Каким-то образом надо заинклюдить все файлы, имена которых $(SRC:.java=.makefile), причем рекурсивно под $(PROJDIR)
#И их замейкать.
sources.lst:
ls -R1 $(PROJDIR) | awk 'BEGIN {print "SRC=\\"} /^\./ {dirname=substr($$0, 0, length($$0)-1)} /\.java/ {print dirname"/"$$0"\\"}' - > sources.lst
#What's so bad: 1. the compilation is unconditional. So far there's some 30 files in the project. What with 3000?
#Solution: generate the list of imports for each file in $(SRC) and set the project (non-system) import classes as prerequisites.
#This suggests that a makefile should be generated and included for each project .java file.
#Which must affect the compilation speed very bad.Какие-нибудь предложения, идеи?

no subject