Usage:
gmake [PROJ=xxxx] [SPARK_CLASSPATH=yyyy] [PARSER_LOG=zzzz] [clean or cleanALL or distclean or help or makefile.inc or pkg or prf or run or solver or stp] [SPARK_STATIC_BUILD=yes] [SPARK_DEBUG=yes] <enter>
Where items in [] are optional.
Type
gmake help <enter>
ifndef SPARK_STATIC_BUILD SPARK_STATIC_BUILD := no endif ## Usage: ## gmake [PROJ=xxxx] [SPARK_CLASSPATH=yyyy] [PARSER_LOG=zzzz] [clean or ## cleanALL or distclean or help or makefile.inc or pkg or prf or ## run or solver or stp] [SPARK_STATIC_BUILD=yes] [SPARK_DEBUG=yes] ## Where items in [] are optional . ## ## First time, type: ## gmake PROJ=xxxx SPARK_CLASSPATH=../class,...etc... ## To create the file 'makefile.inc' and the solver executable ## that has the same name as PROJ . ## ## If 'PROJ=xxxx' is not specified, the default PROJ name is the current ## directory name. ## If 'SPARK_CLASSPATH=...' is not specified, the default for it is : ## 1) The value of the environment variable SPARK_CLASSPATH if that ## environment variable exists. ## or ## 2) .,../class,$(SPARK_DIR)/globalclass,$(SPARK_DIR)/hvactk/class ## ## After the first time, type: ## gmake ## To rebuild the 'makefile.inc' and the solver executable as ## needed using the previous SPARK_CLASSPATH. ## ## If you want a build with Debug information, either set the environment ## variable SPARK_DEBUG=yes, or run gmake with "SPARK_DEBUG=yes" in command line. e.g. ## gmake .... SPARK_DEBUG=yes ## ## If you want a build that does not load the problem at run time, ## run gmake with "SPARK_STATIC_BUILD=yes" in command line. e.g. ## gmake ..... SPARK_STATIC_BUILD=yes ## ## Other targets are: ## gmake clean # To delete all intermediate files. ## gmake cleanALL # clean + delete all run subdirectories. ## gmake distclean # cleanALL + delete .bak .set files. ## gmake help # To show this information. ## gmake makefile.inc # To create makefile.inc file. ## gmake pkg # To make ../PROJ_pkg directory. ## gmake proj_lib # To make PROJ.a file that contains a library ## of compiled atomic classes. ## gmake prf # To make PROJ.prf file. ## gmake run # To make a run using PROJ.inp as input and ## PROJ.run as run control file. If PROJ.run ## is missing a default one is created. ## gmake solver # To make the solver executable i.e. PROJ . ## gmake stp # To make PROJ.stp file. ## ## To change the parser log file name from 'parser.log' to xyz.log , run: ## gmake PARSER_LOG=xyz.log ... ## ## Exit status values are put in file gmake.status : ## ## 1 : Parser error. Caused by bad ....pr , ....cm , or ....cc file, or ## bad SPARK_CLASSPATH . Look at file parser.log . ## 2 : Setupcpp error. Look at file setupcpp.log . ## 3 : Compiler error while compiling class.cc file(s). ## 4 : Compiler error while compiling M_PROJ.cpp file. ## 5 : Linker error while linking M_PROJ_.o and <CLASS...>.o files. ## 6 : Run error. Usually 'cant converge'. Look at file run.log . ## ## makefile.inc looks like: ## M_PROJ= xxxx ## M_DEPsCC= ../../globalclass/aaaa.cc ../class/bbbb.cc ## M_DEPsCM= ../../globalclass/mmmm.cm ## SPARK_CLASSPATH= ".,$(SPARK_DIR)/globalclass" ## ## ## ## include $(SPARK_DIR)/lib/make_compiler.inc ifneq ("$(MAKECMDGOALS)","help") ifndef PROJ PROJ := $(notdir $(CURDIR)) endif M_PROJ := $(PROJ) ifndef SPARK_CLASSPATH include $(SPARK_DIR)/classpath.env endif ifndef SPARK_CLASSPATH SPARK_CLASSPATH := .,../class,$(SPARK_DIR)/globalclass,$(SPARK_DIR)/hvactk/class endif ifeq ($(wildcard gmake.status),gmake.status) _TMP_COMMAND_ := $(shell rm -f gmake.status) endif include makefile.inc endif PARSER_LOG := parser.log PARSER := $(SPARK_DIR)/bin/parser$(EXE) PARSER_FLAGS := -e4 -s6 -p "$(SPARK_CLASSPATH)" SETUP := $(SPARK_DIR)/bin/setupcpp$(EXE) MKMAKINC := $(SPARK_DIR)/bin/mkmakinc$(EXE) override CXXINCLUDES :=-I$(SPARK_DIR)/inc DEBUGPREFIX := ifdef SPARK_DEBUG ifeq ($(SPARK_DEBUG),yes) DEBUGPREFIX := DEBUG/ endif endif ifeq ($(SPARK_STATIC_BUILD),yes) override CXXDEFINES :=$(CXXDEFINES) -DSPARK_STATIC_BUILD LIBS := sparksolver_static.$(OBJ_EXT) *_static.$(LIB_EXT) else LIBS := *.$(LIBDYN_EXT) ifdef WINDIR ifeq ($(CXX),vcpp.sh) LIBDYNLIBS := $(SPARK_DIR)/lib/$(DEBUGPREFIX)libsolver.$(LIB_EXT) else LIBDYNLIBS := $(SPARK_DIR)/bin/$(DEBUGPREFIX)*.$(LIBDYN_EXT) endif else LIBDYNLIBS := endif endif ifdef WINDIR SYSLIBS := -lm else SYSLIBS := -lm -ldl endif override LDXXLIBS := $(addprefix $(SPARK_DIR)/lib/$(DEBUGPREFIX),$(LIBS)) $(SYSLIBS) DEPsO := $(M_DEPsCC:%.cc=%.$(OBJ_EXT)) DEPsODYN := $(M_DEPsCC:%.cc=%.$(LIBDYN_EXT)) %.$(OBJ_EXT) : %.cc -rm -f $@ $(CXX) -c -o $@ $(CXXFLAGS) $(CXXOPTIONS) $(CXXDEFINES) $(CXXINCLUDES) $< ;\ if [ $$? != 0 ] ; then echo 3 > gmake.status ; exit 3 ; fi %.$(OBJ_EXT) : %.cpp -rm -f $@ $(CXX) -c -o $@ $(CXXFLAGS) $(CXXOPTIONS) $(CXXDEFINES) $(CXXINCLUDES) $< ;\ if [ $$? != 0 ] ; then echo 3 > gmake.status ; exit 3 ; fi %.$(LIBDYN_EXT) : %.$(OBJ_EXT) -rm -f $@ $(LIBDYN_COMMAND) -o $@ $^ $(LIBDYNLIBS) ;\ if [ $$? != 0 ] ; then echo 3 > gmake.status ; exit 3 ; fi ifeq ($(CXX),vcpp.sh) rm -f $*.lib $*.exp endif ifeq ($(SPARK_STATIC_BUILD),yes) TARGET := $(M_PROJ)$(EXE) else TARGET := $(M_PROJ).xml endif .PHONY : clean cleanALL distclean help pkg prf proj_lib run solver stp $(M_PROJ).out solver : makefile.inc $(MAKE) $(TARGET) run : makefile.inc $(MAKE) $(M_PROJ).out ifeq ($(SPARK_STATIC_BUILD),yes) $(TARGET) : $(M_PROJ)_.$(OBJ_EXT) $(DEPsO) -rm -f $@ $(LDXX) -o $@ $(LDXXFLAGS) $(LDXXOPTIONS) $^ $(LDXXLIBS) ;\ if [ $$? != 0 ] ; then echo 5 > gmake.status ; exit 5 ; fi $(M_PROJ)_.$(OBJ_EXT) : $(M_PROJ).cpp -rm -f $@ $(CXX) -c -o $@ $(CXXFLAGS) $(CXXOPTIONS) $(CXXDEFINES) $(CXXINCLUDES) $< ;\ if [ $$? != 0 ] ; then echo 4 > gmake.status ; exit 4 ; fi else $(TARGET) : $(DEPsODYN) endif .PRECIOUS : $(DEPsODYN) proj_lib : $(DEPsODYN) ##proj_lib : $(M_PROJ).$(LIB_EXT) ##$(M_PROJ).$(LIB_EXT) : $(DEPsODYN) ## -rm -f $@ ## $(LIB_FROM_OBJs) .PRECIOUS : $(M_PROJ).prf $(M_PROJ).cpp $(M_PROJ).xml prf : $(M_PROJ).prf $(M_PROJ).prf : $(M_PROJ).cpp $(M_PROJ).cpp : $(M_PROJ).xml $(M_PROJ).xml : $(M_PROJ).stp $(SETUP) -rm -f $@ setupcpp.log if [ -r $(M_PROJ).eqs ] ; then \ rm -f $(M_PROJ).eqs.tmp ; tail +6 $(M_PROJ).eqs > $(M_PROJ).eqs.tmp ;\ rm -f $(M_PROJ).prf.tmp ; cp -p $(M_PROJ).prf $(M_PROJ).prf.tmp ; fi $(SETUP) $(M_PROJ) > setupcpp.log 2>&1 ;\ if [ $$? != 0 ] ; then echo 2 > gmake.status ; exit 2 ; fi if [ -r $(M_PROJ).eqs.tmp -a -r $(M_PROJ).eqs ] ; then \ tail +6 $(M_PROJ).eqs > $(M_PROJ).eqsNew.tmp ; \ if cmp -s $(M_PROJ).eqs.tmp $(M_PROJ).eqsNew.tmp ; then \ cp -p $(M_PROJ).prf.tmp $(M_PROJ).prf ;\ fi ; rm -f $(M_PROJ).eqsNew.tmp ; fi rm -f $(M_PROJ).eqs.tmp $(M_PROJ).prf.tmp stp : $(M_PROJ).stp $(M_PROJ).stp : $(M_PROJ).pr $(M_DEPsCM) $(M_DEPsCC) $(PARSER) -rm -f $(M_PROJ).stp $(M_PROJ).tmp $(PARSER_LOG) $(PARSER) $(PARSER_FLAGS) $< 2>&1 | tee $(PARSER_LOG) ;\ if [ $$? != 0 ] ; then echo 1 > gmake.status ; exit 1 ; fi $(M_PROJ).out : $(TARGET) $(M_PROJ).prf $(M_PROJ).run $(M_PROJ).xml -rm -f $@ run.log ifeq ($(SPARK_STATIC_BUILD),yes) ./$(TARGET) $(M_PROJ).prf $(M_PROJ).run > run.log ;\ X=$$? ; if [ $$X != 0 ]; then echo $$X > gmake.status; exit $$X ; fi else $(SPARK_DIR)/bin/$(DEBUGPREFIX)sparksolver $(M_PROJ).prf $(M_PROJ).run $(M_PROJ).xml > run.log ;\ X=$$? ; if [ $$X != 0 ]; then echo $$X > gmake.status; exit $$X ; fi endif $(M_PROJ).run : @echo "Creating a default $(M_PROJ).run file" -rm -f $@ ; cp $(SPARK_DIR)/lib/default.run $@ if [ -r $(M_PROJ).inp ]; then repref $@ InputFiles = "$(M_PROJ).inp" ;\ else echo "WARNING: Input file $(M_PROJ).inp does not exist." ; fi repref $@ OutputFile = "$(M_PROJ).out" makefile.inc : $(M_PROJ).pr $(M_DEPsCM) $(PARSER) -rm -f $(M_PROJ).stp $(M_PROJ).tmp $(PARSER_LOG) $(PARSER) $(PARSER_FLAGS) $< 2>&1 | tee $(PARSER_LOG) ;\ if [ -r $(M_PROJ).stp ] ; then \ Stp=$(M_PROJ).stp ;\ elif [ -r $(M_PROJ).tmp ] ; then \ Stp=$(M_PROJ).tmp ;\ echo 1 > gmake.status ;\ else \ echo 1 > gmake.status ; exit 1 ;\ fi ;\ rm -f makefile.inc ;\ $(MKMAKINC) $$Stp > makefile.inc ;\ echo "SPARK_CLASSPATH=" $(SPARK_CLASSPATH) >> makefile.inc pkg : makefile.inc -rm -rf $(M_PROJ)_pkg mkdir $(M_PROJ)_pkg cp -p $(M_DEPsCC) $(M_DEPsCM) $(M_PROJ)_pkg -cp -p *.set $(M_PROJ)_pkg cp -p $(M_PROJ).pr $(M_PROJ)_pkg/$(M_PROJ)_pkg.pr cp -p makefile.inc $(M_PROJ)_pkg/makefile.inc.old if [ -r $(M_PROJ).inp ] ; then \ cp -p $(M_PROJ).inp $(M_PROJ)_pkg/$(M_PROJ)_pkg.inp ;\ fi -cp -p *.inp $(M_PROJ)_pkg -cp -p *.prf $(M_PROJ)_pkg -cp -p *.run $(M_PROJ)_pkg if [ -d ../$(M_PROJ)_pkg ] ; then rm -rf ../$(M_PROJ)_pkg ; fi mv $(M_PROJ)_pkg .. clean : rm -f $(M_PROJ).stp $(PARSER_LOG) parser.log gmake.status rm -f $(M_PROJ).cpp $(M_PROJ).eqs setupcpp.log rm -f $(TARGET) $(M_PROJ)_.$(OBJ_EXT) rm -f $(M_PROJ).$(LIB_EXT) rm -f $(M_PROJ).out $(M_PROJ).xml solver.status rm -f $(DEPsO) rm -f $(DEPsODYN) rm -f *.factory.log rm -f debug.log error.log run.log .m.log -rm -f backtracking_$(M_PROJ)_*.log -rm -f *.template -rm -f *.tmp -rm -f \#* -rm -f *~ -rm -f *\% -rm -f *.rsp rm -f makestp.log symbolics.log sparksym.log matho.err tmp.txt if [ -r makefile.inc ] ; then rm -f makefile.inc.bak ; \ mv makefile.inc makefile.inc.bak ; fi cleanALL : clean if [ -r $(M_PROJ).prf ] ; then \ rm -f $(M_PROJ).prf.bak ; mv $(M_PROJ).prf $(M_PROJ).prf.bak ; fi -rm -f default.prf -rm -f *.init -rm -f *.snap if [ -r *.set ] ; then \ for I in *.set ; do rm -rf `basename $$I .set` ; done ; fi -rm -f *.trc distclean : cleanALL -rm -f $(M_PROJ).*.bak -rm -f makefile makefile.inc.bak -rm -f $(M_PROJ)_inp.set help : @head -70 $(SPARK_DIR)/lib/makefile.prj @echo "SPARK_CLASSPATH=$(SPARK_CLASSPATH)" @echo "PROJ=$(PROJ)" @echo "SPARK_DEBUG=$(SPARK_DEBUG)" @echo "SPARK_STATIC_BUILD=$(SPARK_STATIC_BUILD)" @echo "(wildcard classpath.env)=$(wildcard classpath.env)" @echo "(wildcard ../classpath.env)=$(wildcard ../classpath.env)" @echo "(wildcard $(SPARK_DIR)/classpath.env)=$(SPARK_DIR)/classpath.env)" @echo "CXXFLAGS=$(CXXFLAGS)" @echo "CXXOPTIONS=$(CXXOPTIONS)" @echo "CXXDEFINES=$(CXXDEFINES)" @echo "CXXINCLUDES=$(CXXINCLUDES)" @echo "LDXXFLAGS=$(LDXXFLAGS)" @echo "LDXXOPTIONS=$(LDXXOPTIONS)" @echo "LDXXLIBS=$(LDXXLIBS)"