.SUFFIXES: .o .c .pc .l .y .C #define YaccRule() @@\ .y.c: @@\ yacc -dv $*.y #define LexRule() @@\ .l.c: @@\ lex $*.l #define CCRule() @@\ .c.o: @@\ $(RM) $@ @@\ $(CC) -c $(CFLAGS) $*.c @@\ @@\ .C.o: @@\ $(RM) $@ @@\ $(CCC) -c $(CFLAGS) $(OCFLAGS) $*.C #ifndef SemanticChecker #define SemanticChecker() @@\ demeter-sem-check: notmod/sem-check.TAG @@\ @@\ notmod/sem-check.TAG: $(USERCD) @@\ -@echo Running semantic checker ... @@\ $(DEMETER)/bin/sem-check -i $(USERCD) @@\ -@$(RM) notmod/sem-check.TAG @@\ -@date > notmod/sem-check.TAG #endif /* SemanticChecker */ #ifndef GennerateDir #define GennerateDir() @@\ generate-dir: @@\ -@for _dir_ in . $(COMPONENTS); \ do $(RM) $$_dir_/?*-DEM.C; \ done @@\ -@for _dir_ in . $(COMPONENTS); \ do $(RM) -r $$_dir_/inter-pps; \ done @@\ -@$(RM) -r main.C.sample inter-pps notmod/def notmod/headers \ notmod/include notmod/lib notmod/`get-cpu` ?*.bak @@\ -@if [ ! -d scanner ]; then $(MKDIR) scanner; fi @@\ -@if [ ! -d notmod ]; then $(MKDIR) notmod; fi @@\ -@if [ ! -d notmod/def ]; then $(MKDIR) notmod/def; fi @@\ -@if [ ! -d notmod/cds ]; then $(MKDIR) notmod/cds; fi @@\ -@if [ ! -d notmod/headers ]; then $(MKDIR) notmod/headers; fi @@\ -@if [ ! -d notmod/logs ]; then $(MKDIR) notmod/logs; fi @@\ -@if [ ! -d notmod/include ]; then $(MKDIR) notmod/include; fi @@\ -@if [ ! -d notmod/lib ]; then $(MKDIR) notmod/lib; fi @@\ -@echo -n `whoami` " at " $(cwd) " started at " \ >> $(GENERATELOGFILE) @@\ -@date >> $(GENERATELOGFILE) #endif /* GennerateDir */ #ifndef GenerateNotmodImake #define GenerateNotmodImake() @@\ generate-notmodimake: notmod/Imakefile @@\ @@\ notmod/Imakefile: Imakefile @@\ -@$(RM) notmod/Imakefile @@\ -@echo \#\d\e\fine \I\H\a\v\e\Subdirs > notmod/Imakefile @@\ -@echo \#\d\efine \P\assCDebugFlags \'\C\DEBUGFLAGS=$$\(\C\DEBUGFLAGS\)\' \ >> notmod/Imakefile @@\ -@echo >> notmod/Imakefile @@\ -@echo \S\IMI = $(SIMI) >> notmod/Imakefile @@\ -@echo \S\UBDIRS = `$(DEMETER)/bin/get-cpu` >> notmod/Imakefile @@\ -@echo \E\XTRAOBJS = $(EXTRAOBJS) >> notmod/Imakefile @@\ -@echo \I\NCLUDES = $(INCLUDES) >> notmod/Imakefile @@\ -@echo \D\EFINES = $(DEFINES) >> notmod/Imakefile @@\ -@echo \L\O\C\AL_LIBRARIES = $(LOCAL_LIBRARIES) \ >> notmod/Imakefile @@\ -@echo CCC = $(CCC) >> notmod/Imakefile @@\ -@echo ccC = $(ccC) >> notmod/Imakefile @@\ -@echo EXECLIBFLAG = $(EXECLIBFLAG) >> notmod/Imakefile @@\ -@echo OCFLAGS = $(OCFLAGS) >> notmod/Imakefile @@\ -@echo EXTRA_LOAD_FLAGS = $(EXTRA_LOAD_FLAGS) >> notmod/Imakefile @@\ -@echo DEMETER = $(DEMETER) >> notmod/Imakefile @@\ -@echo TARGETLIBDIR = $(TARGETLIBDIR) >> notmod/Imakefile @@\ -@echo TARGETLIBNAME = $(TARGETLIBNAME) >> notmod/Imakefile @@\ -@echo TARGETINCLUDEDIR= $(TARGETINCLUDEDIR) >> notmod/Imakefile @@\ -@echo TARGETINCLUDENAME= $(TARGETINCLUDENAME) >>notmod/Imakefile @@\ -@echo TOPENVNAME= $(TOPENVNAME) >> notmod/Imakefile @@\ -@echo >> notmod/Imakefile @@\ -@echo MFLAGS = SIMI=\'$$\(SIMI\)\' \\ >> notmod/Imakefile @@\ -@echo " " LOCAL_LIBRARIES=\"$$\(LOCAL_LIBRARIES\)\" \\ \ >> notmod/Imakefile @@\ -@echo " " EXTRAOBJS=\"$$\(EXTRAOBJS\)\" \\ \ >> notmod/Imakefile @@\ -@echo " " INCLUDES=\"$$\(INCLUDES\)\" \\ \ >> notmod/Imakefile @@\ -@echo " " DEFINES=\"$$\(DEFINES\)\" \\ \ >> notmod/Imakefile @@\ -@echo " " CCC=\'$$\(CCC\)\' \\ \ >> notmod/Imakefile @@\ -@echo " " EXTRA_LOAD_FLAGS=\"$$\(EXTRA_LOAD_FLAGS\)\" \\ \ >> notmod/Imakefile @@\ -@echo " " ccC=\'$$\(ccC\)\' \\ \ >> notmod/Imakefile @@\ -@echo " " EXECLIBFLAG=\'$$\(EXECLIBFLAG\)\' \\ \ >> notmod/Imakefile @@\ -@echo " " DEMETER=\'$$\(DEMETER\)\' \\ \ >> notmod/Imakefile @@\ -@echo " " TARGETLIBDIR=\'$$\(TARGETLIBDIR\)\' \\ \ >> notmod/Imakefile @@\ -@echo " " TARGETLIBNAME=\'$$\(TARGETLIBNAME\)\' \\ \ >> notmod/Imakefile @@\ -@echo " " TARGETINCLUDENAME=\'$$\(TARGETINCLUDENAME\)\' \\ \ >> notmod/Imakefile @@\ -@echo " " TARGETINCLUDEDIR=\'$$\(TARGETINCLUDEDIR\)\' \\ \ >> notmod/Imakefile @@\ -@echo " " TOPENVNAME=\'$$\(TOPENVNAME\)\' \ >> notmod/Imakefile @@\ -@echo >> notmod/Imakefile @@\ -@echo >> notmod/Imakefile @@\ -@echo \M\a\keSubdirs\($$\(\S\UBDIRS\)\) >> notmod/Imakefile @@\ -@echo \D\e\pendSubdirs\($$\(S\UBDIRS\)\) >> notmod/Imakefile @@\ -@(cd notmod; $(DEMETER)/bin/dmkmf) #endif /* GenerateNotmodImake */ #ifndef GenerateClasses #define GenerateClasses() @@\ gen-classes: @@\ -@$(RM) notmod/def/?* notmod/cds/cd-inter scanner/lex-syntax \ main.C.sample @@\ -@echo Running C++ code generator ... @@\ $(DEMETER)/bin/generate $(SIMI) $(TOPENVNAME) "$(NOCONSTRUCTOR)" @@\ $(DEMETER)/bin/gen-hash notmod/cds/cd-param-exp $(TOPENVNAME) \ $(DEMETERBUILDLIBS) dh > notmod/def/make_instance.info #endif /* GenerateClasses */ #ifndef GenerateScanner #define GenerateScanner() @@\ gen-scanner: @@\ -@$(RM) scanner/lex-DEM.l scanner/lex.yy.c @@\ -@cat $(FIXEDDIR)/lex-definitions \ scanner/lex-syntax $(FIXEDDIR)/lex-comment \ $(FIXEDDIR)/lex-white-space \ $(FIXEDDIR)/lex-class-terminals > scanner/lex-DEM.l @@\ -@lex -nt scanner/lex-DEM.l > scanner/lex.yy.c @@\ -@if [ -f scanner/cd-print ]; then \ if [ x"yes" = x$(OVERWRITECDPRINT) ]; then \ $(RM) scanner/cd-print.old; \ $(MV) scanner/cd-print scanner/cd-print.old; fi; fi @@\ -@if [ -f scanner/cd-parse ]; then \ if [ x"yes" = x$(OVERWRITECDPRINT) ]; then \ $(RM) scanner/cd-parse.old; \ $(MV) scanner/cd-parse scanner/cd-parse.old; fi; fi @@\ -@if [ x"yes" = x$(OVERWRITECDPRINT) ]; then\ cp notmod/cds/cd-print scanner; fi @@\ -@if [ x"yes" = x$(OVERWRITECDPARSE) ]; then\ cp notmod/cds/cd-parse scanner; fi #endif /* GenerateScanner */ #ifndef CodeGenerator #define CodeGenerator() @@\ demeter-generate: notmod/generate.TAG @@\ @@\ notmod/generate.TAG: notmod/cds/cd-param-exp @@\ -@make do-generate @@\ -@$(RM) notmod/generate.TAG @@\ -@date > notmod/generate.TAG @@\ -@$(RM) generate.benefit @@\ -@$(DEMETER)/bin/generate-productivity $(USERCD) > generate.benefit @@\ @@\ do-generate: generate-dir gen-classes gen-scanner generate-notmodimake @@\ -@$(RM) COPYRIGHT INFO @@\ -@cp $(FIXEDDIR)/COPYRIGHT $(FIXEDDIR)/INFO . @@\ -@chmod 644 COPYRIGHT INFO @@\ -@$(DEMETER)/bin/version >> COPYRIGHT @@\ -@date >> COPYRIGHT @@\ -@$(RM) README @@\ -@cp $(FIXEDDIR)/README . @@\ -@chmod 644 README @@\ -@if [ ! -f main.C ]; then cp $(FIXEDDIR)/main.C .; \ chmod 644 main.C; fi @@\ -@if [ ! -f global.h ]; then cp $(FIXEDDIR)/global.h .; \ chmod 644 global.h; fi @@\ -@$(RM) run @@\ -@$(CP) $(FIXEDDIR)/run . @@\ -@chmod 755 run @@\ -@echo "setenv GEN_DIR ./scanner" >> run @@\ -@echo './notmod/`$(DEMETER)/bin/get-cpu`/run-exec $$*' >> run @@\ -@echo >> run @@\ -@echo -n `whoami` " at " $(cwd) " ended at " \ >> $(GENERATELOGFILE) @@\ -@date >> $(GENERATELOGFILE) @@\ @@\ GennerateDir() @@\ @@\ GenerateNotmodImake() @@\ @@\ GenerateClasses() @@\ @@\ GenerateScanner() #endif /* CodeGenerator */ #ifndef DemeterCompile #define DemeterCompile() @@\ demeter-compile: \ propagate \ headers \ generate-notmodimake \ process-files \ /*remove-removed-files*/ @@\ -@$(RM) notmod/`$(DEMETER)/bin/get-cpu`/Imakefile @@\ -@(cd notmod; $(DEMETER)/bin/gen-imakefile $(EXECLIBFLAG) \ `$(DEMETER)/bin/get-cpu`; \ mv `$(DEMETER)/bin/get-cpu`/Imakefile ttt; \ echo OCFLAGS=$(OCFLAGS) > `$(DEMETER)/bin/get-cpu`/Imakefile; \ cat ttt >> `$(DEMETER)/bin/get-cpu`/Imakefile; rm ttt) @@\ -@(cd notmod/`$(DEMETER)/bin/get-cpu`; $(DEMETER)/bin/dmkmf) @@\ make depend @@\ @@\ headers: @@\ -@echo Generating prototypes ... @@\ $(DEMETER)/bin/headers @@\ @@\ propagate: @@\ -@echo Running propagation pattern compiler ... @@\ if test x$(COMPONENTS) = x"";\ then $(DEMETER)/bin/propagate $(TOPENVNAME) $(WANTPPINTER); else \ $(DEMETER)/bin/propagate $(TOPENVNAME) $(WANTPPINTER) \ -c $(COMPONENTS); fi @@\ -@$(RM) notmod/propagate.TAG @@\ -@date > notmod/propagate.TAG @@\ -@$(DEMETER)/bin/ppbenefit . $(COMPONENTS) > propagate.benefit @@\ @@\ process-files: @@\ -@echo Running preprocessor ... @@\ -@if [ ! -d notmod/$(LOCALCPU) ] ; \ then mkdir notmod/$(LOCALCPU); fi @@\ -@if [ ! -d notmod/tmp ] ; \ then mkdir notmod/tmp; fi @@\ for _dir_ in . $(COMPONENTS) notmod/headers scanner notmod/def; \ do $(COMPPP) notmod/cds/cd-param-exp $(TOPENVNAME) \ -p notmod/$(LOCALCPU) $$_dir_/?*.[cCh]; \ ls ?*.[cCh] >> notmod/tmp/filelist; \ done @@\ -@$(RM) notmod/tmp/filelist @@\ -@for _dir_ in . $(COMPONENTS) notmod/headers scanner notmod/def; \ do for _file_ in $$_dir_/?*.[cCh]; \ do basename $$_file_ >> notmod/tmp/filelist; \ done; \ done @@\ @@\ remove-removed-files: @@\ for _file_ in notmod/$(LOCALCPU)/?*.[cCh]; \ do if [ x`echo $$_file_ | /local/gnu/bin/grep -f notmod/tmp/filelist` = x ]; then\ $(RM) $$_file_; fi; \ @@\ done #endif #ifndef DemeterProgram #define DemeterProgram() @@\ @@\ MKDIR = mkdir @@\ COMPPP = $(DEMETER)/bin/comp-pp $(NOSUFFIX) @@\ DEMETERUSERTOP = . @@\ LOCALCPU = `$(DEMETER)/bin/get-cpu` @@\ DEMETERCOMPILEDIR = notmod/$(LOCALCPU) @@\ DEMETERUSERPROGRAM = $(DEMETERCOMPILEDIR)/run-exec @@\ FIXEDDIR = $(DEMETER)/fixed @@\ GENERATELOGFILE = notmod/logs/generate.log @@\ MFLAGS = SIMI='$(SIMI)' \ LOCAL_LIBRARIES="$(LOCAL_LIBRARIES)" \ EXTRAOBJS="$(EXTRAOBJS)" \ INCLUDES="$(INCLUDES)" \ DEFINES="$(DEFINES)" \ CCC='$(CCC)' \ ccC='$(ccC)' \ EXTRA_LOAD_FLAGS="$(EXTRA_LOAD_FLAGS)" \ EXECLIBFLAG='$(EXECLIBFLAG)' \ TARGETLIBDIR='$(TARGETLIBDIR)' \ TARGETLIBNAME='$(TARGETLIBNAME)' \ TARGETINCLUDENAME='$(TARGETINCLUDENAME)' \ TARGETINCLUDEDIR='$(TARGETINCLUDEDIR)' \ TOPENVNAME='$(TOPENVNAME)' @@\ CFLAGS = $(CDEBUGFLAGS) $(CCOPTIONS) $(ALLDEFINES) $(OFLAGS) @@\ @@\ @@\ AllTarget(Makefile $(DEMETERUSERPROGRAM)) @@\ @@\ $(DEMETERUSERPROGRAM): demeter-sem-check \ demeter-generate \ demeter-compile @@\ @@\ SemanticChecker() @@\ @@\ CodeGenerator() @@\ @@\ DemeterCompile() @@\ @@\ MakeSubdirs($(SUBDIRS)) @@\ DependSubdirs($(SUBDIRS)) @@\ @@\ clean:: @@\ for _dir_ in . $(COMPONENTS); \ do $(RM) $$_dir_/?*-DEM.C; \ done @@\ for _dir_ in . $(COMPONENTS); \ do $(RM) -r $$_dir_/inter-pps; \ done @@\ $(RM) -r inter-pps @@\ $(RM) -r notmod/tmp/?* @@\ make cleancpu @@\ @@\ cleancpu: @@\ if [ -f notmod/`get-cpu`/Imakefile ]; then \ mv notmod/`get-cpu`/Imakefile Imakefile.notmod_cpu; fi @@\ if [ -f notmod/`get-cpu`/Makefile ]; then \ mv notmod/`get-cpu`/Makefile Makefile.notmod_cpu; fi @@\ $(RM) -r notmod/`get-cpu`/?* @@\ if [ -f Imakefile.notmod_cpu ]; then \ mv Imakefile.notmod_cpu notmod/`get-cpu`/Imakefile; fi @@\ if [ -f Makefile.notmod_cpu ]; then \ mv Makefile.notmod_cpu notmod/`get-cpu`/Makefile; fi @@\ @@\ clobber: @@\ for _dir_ in . $(COMPONENTS); \ do $(RM) $$_dir_/?*-DEM.C; \ done @@\ for _dir_ in . $(COMPONENTS); \ do $(RM) -r $$_dir_/inter-pps; \ done @@\ $(RM) -r main.C.sample inter-pps notmod ?*.bak #endif /* DemeterProgram */ #ifndef DemeterSysTopLibraryTarget #define DemeterSysTopLibraryTarget(name,objlist) @@\ AllTarget(Concat($(TOP)/lib-$(SIMI)/$(CURRCPU)/lib,name.a)) @@\ @@\ Concat($(TOP)/lib-$(SIMI)/$(CURRCPU)/lib,name.a): objlist @@\ $(RM) $@ @@\ $(AR) $@ objlist @@\ RanLibrary($@) #endif /* DemeterSysTopLibraryTarget */ #ifndef DemeterSysLibraryTarget #define DemeterSysLibraryTarget(name,objlist) @@\ AllTarget(Concat($(TOP)/lib-$(SIMI)/$(CURRCPU)/lib,name.a)) @@\ @@\ Concat($(TOP)/lib-$(SIMI)/$(CURRCPU)/lib,name.a): objlist @@\ $(AR) $@ objlist @@\ RanLibrary($@) #endif /* DemeterSysLibraryTarget */ #ifndef DemeterSysCmdTarget #define DemeterSysCmdTarget(name,objlist) @@\ Concat($(TOP)/bin/util/name/$(CURRCPU)/run-exec: objlist @@\ $(CCC) -o Concat($(TOP)/bin/util/name/$(CURRCPU)/run-exec #endif /* DemeterSysCmdTarget */ #ifndef DemeterEnvLibraryTarget #define DemeterEnvLibraryTarget(libname,objlist1,objlist2) @@\ AllTarget(libname) @@\ @@\ libname: objlist1 objlist2 @@\ $(RM) $@ @@\ $(AR) $@ objlist1 @@\ $(AR) $@ objlist2 @@\ RanLibrary($@) #endif /* DemeterEnvLibraryTarget */ #ifndef DemeterEnvHeadersTarget #define DemeterEnvHeadersTarget(incfile) @@\ AllTarget(incfile) @@\ @@\ incfile: ?*.h @@\ $(RM) $@ @@\ $(DEMETER)/bin/gen-include Concat($(TOPENVNAME),.h) incfile #endif /* DemeterEnvHeadersTarget */ #ifndef InstallDemeterDirs #define InstallDemeterDirs() @@\ release:: @@\ for i in $(RELSUBDIRS) ;\ @@\ do \ @@\ (if [ -d $(DESTDIR)/$$i ] ; then \ chmod -R 700 $(DESTDIR)/$$i; fi; \ rm -rf $(DESTDIR)/$$i;\ /usr/bin/install -d -m 0755 $(DESTDIR)/$$i;\ echo Releasing "in $(DESTDIR)/$$i..."; cd $$i;\ $(MAKE) DESTDIR=$(DESTDIR)/$$i $(MFLAGS) release);\ done #endif /* InstallDemeterDirs */ #ifndef InstallDemeterBin #define InstallDemeterBin() @@\ release:: @@\ for program in ?*; \ @@\ do \ if [ -f $$program ] ; then \ if [ -x $$program ] ; then \ /usr/bin/install -c -m 555 \ $$program $(DESTDIR); fi; fi;\ done #endif /* InstallDemeterBin */ #ifndef InstallDemeterData #define InstallDemeterData() @@\ release:: @@\ for program in ?*; \ @@\ do \ if [ -f $$program ] ; then \ /usr/bin/install -c -m 0444 \ $$program $(DESTDIR); fi;\ done #endif /* InstallDemeterData */ #ifndef InstallDemeterLib #define InstallDemeterLib(libs) @@\ release:: @@\ for lib in libs; \ @@\ do \ if [ -f $$lib ] ; then \ /usr/bin/install -c -m 0444 \ $$lib $(DESTDIR); fi;\ RanLibrary($(DESTDIR)/$$lib);\ done #endif /* InstallDemeterLib */ /* Default rules in the Imakefiles */ CCRule()