2 # Title: makefile.gmake
6 # Description: GNU make file for Cxx Grammar tester under NT
9 # INTDIR intermediate directory for objects (defaults to ".\Release")
10 # OUTDIR output directory for executable (defaults to ".\Release")
11 # MSINCDIR path of main system include directory (defaults to $(MSVCDIR)\Include)
15 # builds '$(OUTDIR)'/grammar.exe
17 # eliminates $(INTDIR) intermediates
19 # eliminates $(INTDIR) and '$(OUTDIR)' intermediates
21 # generates the distribution kits
24 # copies changed sources from C: to $(BACKUPDIR)
26 # tars up changes ready for transfer to Unix
29 # Build is error and warning free as
30 # nmake -f makefile.gmake
31 # (after using - Visual C++ 6
32 # "C:\Program Files\Microsoft Visual Studio\VC98\Bin\vcvars32.bat"
34 # "C:\Program Files\DevStudio\VC\Bin\vcvars32.bat"
35 # in a Command Prompt to set up the Visual C++ environment).
36 # Alternatively do a "Compile xxx" to compile target xxx from the "grammar files->Targets"
37 # after loading root.dsw into DevStudio.
40 .SUFFIXES: .l .y .hxx .cxx .cpp .obj
48 MSINCDIR = $(MSVCDIR)\Include
49 BACKUPDIR = Q:/P541/C/BackUp/grammar
50 TARDELTADIR = P:/$(USERNAME)
52 CPRINT = "../tools/cprint/$(OUTDIR)/cprint.exe" -b -c150 -e -h0 -f1 -l69 -n25 -t4
53 WIDE_CPRINT = "../tools/cprint/$(OUTDIR)/cprint.exe" -b -c150 -e -h0 -f1 -l69 -n0 -t4
55 CCP = "../tools/ccp/$(OUTDIR)/ccp.exe"
58 #LEX = "../tools/flex_pp/$(OUTDIR)/flex_pp.exe" -S../tools/flex_pp/flexskel.cc -H../tools/flex_pp/flexskel.h
62 #YACC = "../tools/bison_pp/$(OUTDIR)/bison_pp.exe" -S ../tools/bison_pp/bison.cc -H ../tools/bison_pp/bison.h
68 CPP_RELEASE_FLAGS = /ML /O2 /D "NDEBUG"
69 CPP_DEBUG_FLAGS = /MLd /Gm /ZI /Od /D "_DEBUG" /GZ
70 CPP_COMMON_FLAGS = /W3 /GX /Fo"$(INTDIR)/" /Fd"$(INTDIR)/$(TARGET)" /c
71 CPP_DEFS = /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "NEEDS_YYWRAP"
72 CPP_INCS = /I "$(SRCDIR)" /I "." /I "$(DUMMYDIR)"
74 LINK32 = link.exe /nologo /machine:I386 /subsystem:console
75 LINK_RELEASE_FLAGS = /incremental:no
76 LINK_DEBUG_FLAGS = /incremental:yes /debug /pdbtype:sept
77 LINK32_LIBS = kernel32.lib
79 MAKEFILE = makefile.gmake
80 DUMMIES = $(DUMMYDIR)/unistd.h
82 include makefile.macros
84 OBJECTS = $(COMPOSITE_SOURCES:%.cpp=$(INTDIR)/%.obj)
86 all : $(ALL_FILES) executable
88 executable : $(OUTDIR)/$(TARGET).exe
90 $(DUMMYDIR)/unistd.h :
91 @- sh -c 'if test ! -d "$(@D)"; then echo mkdir -p "$(@D)"; mkdir -p "$(@D)"; fi'
93 @- sh -c 'echo "#include <io.h>" > "$@"'
94 @- sh -c 'chmod -w "$@"'
97 @- sh -c 'if test ! -d "$(@D)"; then echo mkdir -p "$(@D)"; mkdir -p "$(@D)"; else rm -f $(@D)/$*.cxx; fi'
98 - sh -c '$(LEX) $(LEX_FLAGS) $*.l'
99 @- sh -c 'mv -f lex.yy.c $(@D)/$*.cxx'
100 @- sh -c 'chmod -w $(@D)/$*.cxx'
102 $(SRCDIR)/%.cxx $(SRCDIR)/%.hxx : %.y
103 @- sh -c 'if test ! -d "$(@D)"; then echo mkdir -p "$(@D)"; mkdir -p "$(@D)"; else rm -f $(@D)/$*.output $(@D)/$*.cxx $(@D)/$*.hxx; fi'
104 - sh -c '$(YACC) $(YACC_FLAGS) $*.y'
105 @- sh -c 'mv -f $*.tab.c $(@D)/$*.cxx'
106 @- sh -c 'mv -f $*.tab.h $(@D)/$*.hxx'
107 @- sh -c 'mv -f $*.output $(@D)/$*.output'
108 @- sh -c 'chmod -w $(@D)/$*.cxx $(@D)/$*.hxx $(@D)/$*.output'
110 .\Release/%.obj : %.cpp
111 @- sh -c 'if test ! -d "$(@D)"; then echo mkdir -p "$(@D)"; mkdir -p "$(@D)"; else rm -f "$@"; fi'
112 @- sh -c '$(CPP) $(CPP_INCS) $(CPP_DEFS) $(CPP_RELEASE_FLAGS) $(CPP_COMMON_FLAGS) "$<"'
114 .\Debug/%.obj : %.cpp
115 @- sh -c 'if test ! -d "$(@D)"; then echo mkdir -p "$(@D)"; mkdir -p "$(@D)"; else rm -f "$@"; fi'
116 @- sh -c '$(CPP) $(CPP_INCS) $(CPP_DEFS) $(CPP_DEBUG_FLAGS) $(CPP_COMMON_FLAGS) "$<"'
118 .\Release/$(TARGET).exe : $(OBJECTS) $(MAKEFILE)
119 @- sh -c 'if test ! -d "$(@D)"; then echo mkdir -p "$(@D)"; mkdir -p "$(@D)"; fi'
121 @- sh -c '$(LINK32) /pdb:"$(@D)/$(TARGET).pdb" /out:"$@" $(LINK_RELEASE_FLAGS) $(OBJECTS:%="%") $(LINK32_LIBS)'
123 .\Debug/$(TARGET).exe : $(OBJECTS) $(MAKEFILE)
124 @- sh -c 'if test ! -d "$(@D)"; then echo mkdir -p "$(@D)"; mkdir -p "$(@D)"; fi'
126 @- sh -c '$(LINK32) /pdb:"$(@D)/$(TARGET).pdb" /out:"$@" $(LINK_DEBUG_FLAGS) $(OBJECTS:%="%") $(LINK32_LIBS)'
128 $(LSTDIR)/CxxLexer.list : CxxLexer.cpp $(LEXER_FILES) $(L_FILES)
129 @- sh -c 'if test ! -d "$(@D)"; then echo mkdir -p "$(@D)"; mkdir -p "$(@D)"; else rm -f "$@"; fi'
130 sh -c '$(CPRINT) $? > "$@"'
132 $(LSTDIR)/CxxParser.list : CxxParser.cpp $(PARSER_FILES) $(Y_FILES)
133 @- sh -c 'if test ! -d "$(@D)"; then echo mkdir -p "$(@D)"; mkdir -p "$(@D)"; else rm -f "$@"; fi'
134 sh -c '$(CPRINT) $? > "$@"'
136 $(LSTDIR)/CxxToken.list : CxxToken.cpp $(TOKEN_FILES)
137 @- sh -c 'if test ! -d "$(@D)"; then echo mkdir -p "$(@D)"; mkdir -p "$(@D)"; else rm -f "$@"; fi'
138 sh -c '$(CPRINT) $? > "$@"'
140 $(LSTDIR)/CxxMake.list : $(MAKE_FILES)
141 @- sh -c 'if test ! -d "$(@D)"; then echo mkdir -p "$(@D)"; mkdir -p "$(@D)"; else rm -f "$@"; fi'
142 sh -c '$(CPRINT) $? > "$@"'
144 source_kit: CxxNtSrc.tgz
146 CxxNtSrc.tgz : CxxNtSrc.tar
148 @- sh -c 'rm -f "$@"'
149 @- sh -c 'gzip "$<" -c > "$@"'
150 @- sh -c 'chmod -w "$@"'
154 @- sh -c 'rm -f "$@"'
155 @- sh -c 'tar cf "$@" $(ALL_FILES:%="$(MAKE_TAR_PATH)%") "Release/grammar.exe"'
156 @- sh -c 'chmod -w "$@"'
159 @- sh -c 'cd $(PWD); tar rf "$(@F)" $(ALL_FILES:%="$(MAKE_TAR_PATH)%")'
163 tar_delta : $(TARDELTADIR)/$(TARGET)_delta.tar
165 $(TARDELTADIR)/$(TARGET)_delta.tar : $(ALL_FILES)
166 @- sh -c 'if test ! -d "$(@D)"; then echo mkdir -p "$(@D)"; mkdir -p "$(@D)"; else rm -f "$@"; fi'
167 - sh -c 'tar cf - $(?:%="%") > "$@"'
168 @- sh -c 'chmod -w "$@"'
170 backup : $(ALL_FILES:%=$(BACKUPDIR)/%) $(BACKUPDIR)/grammar.dsp
173 @- sh -c 'if test ! -d "$(@D)"; then echo mkdir -p "$(@D)"; mkdir -p "$(@D)"; else rm -f "$@"; fi'
175 @- sh -c 'cp "$<" "$@"'
176 @- sh -c 'chmod -w "$@"'
179 @- sh -c 'if test -d "$(INTDIR)"; then rm -f "$(INTDIR)"/*.idb "$(INTDIR)"/*.ilk "$(INTDIR)"/*.obj "$(INTDIR)"/*.pch "$(INTDIR)"/*.pdb; fi'
180 @- sh -c 'rm -f "$(SRCDIR)"/*.xxh'
183 @- sh -c 'rm -rf "$(DUMMYDIR)" Release Debug $(SRCDIR)'
184 @- sh -c 'rm -f "tests/*/results/*"'
186 $(INTDIR)/CxxLexer.obj : CxxLexing.cxx CxxLexing.hxx $(SRCDIR)/CxxLexer.cxx $(SRCDIR)/CxxParser.hxx $(DUMMIES)
187 $(INTDIR)/CxxParser.obj : CxxParsing.cxx CxxParsing.hxx $(SRCDIR)/CxxParser.cxx $(SRCDIR)/CxxParser.hxx
188 $(INTDIR)/CxxToken.obj : CxxToken.cxx CxxToken.hxx