2 # Title: Make file for Cxx Grammar tester.
8 # Description: This stripped down make file builds the Cxx Grammar tester.
11 # default, executable, normal
12 # builds $(ARCH)o/grammar using default (sun) compiler
14 # builds $(ARCH)o/grammar using sun compiler, yacc and lex
16 # builds $(ARCH)o/grammar using gnu compiler, bison and flex
18 # builds $(ARCH)o_g/grammar
20 # eliminates $(ARCH)o* intermediates
22 # eliminates $(ARCH)o* intermediates and executables
24 # generates the distribution kits
26 # Switch settings are appropriate for Sun C++ 4.2.
27 # Commented settings indicate what might be appropriate for gcc once it supports templates plausibly.
29 # Latest Modification:
30 # EDW Date: 14-Jun-2001 Original
44 OBJ_DIR_PI = $(ARCH)o_pi
45 OBJ_DIR_G = $(ARCH)o_g
46 OBJ_DIR_PI_G = $(ARCH)o_pi_g
47 PRECIOUS_DIRECTORIES = $(SRCDIR) $(OBJ_DIR) $(OBJ_DIR_PI) $(OBJ_DIR_G) $(OBJ_DIR_PI_G)
48 PRECIOUS_LIBRARIES = $(OBJ_DIR)/lib$(TARGET).a $(OBJ_DIR_PI)/lib$(TARGET).so \
49 $(OBJ_DIR_G)/lib$(TARGET).a $(OBJ_DIR_PI_G)/lib$(TARGET).so
51 .PRECIOUS: $(PRECIOUS_DIRECTORIES) $(PRECIOUS_LIBRARIES) $(SRCDIR)/$(TARGET).dep
53 LINK = $(PURIFY) $(CC)
55 EGCS_1_0_2_LINK_LIBS = -ll
56 SUN_4_2_LINK_LIBS = -lsunmath -lm /usr/ccs/lib/libl.a
57 LINK_LIBS = $($(COMPILER)_LINK_LIBS)
61 CC = $($(COMPILER)_CC)
69 _PIC = $($(COMPILER)_PIC)
71 SUN_4_2_CFLAGS = -temp=. -ptr. -noex
73 CFLAGS = $($(COMPILER)_CFLAGS)
76 EGCS_1_0_2_CC_INCS = -I../$(DUMMYDIR)
77 CC_INCS = -I../$(SRCDIR) -I.. $($(COMPILER)_CC_INCS)
79 SUN_4_2_CC_DEFS = -D__EXTERN_C__ -DNEEDS_BOOL -DNEEDS_YYWRAP
81 CC_DEFS = $($(COMPILER)_CC_DEFS)
85 LFLAGS = $($(COMPILER)_LFLAGS)
93 LEX = $($(COMPILER)_LEX)
95 SUN_4_2_LEX_FLAGS = -n
96 EGCS_1_0_2_LEX_FLAGS =
97 LEX_FLAGS = $($(COMPILER)_LEX_FLAGS)
100 EGCS_1_0_2_YACC = bison
101 YACC = $($(COMPILER)_YACC)
103 SUN_4_2_YACC_FLAGS = -d -t -v
104 EGCS_1_0_2_YACC_FLAGS = -d -t -v -y
105 YACC_FLAGS = $($(COMPILER)_YACC_FLAGS)
107 default : executable $(ALL_FILES)
109 #../import.make is empty by default, but may be provided to copy sources from somewhere.
112 IMPORT_PATH = grammar
113 include ../import.make
115 include makefile.macros
117 LIB_OBJS = $(COMPOSITE_SOURCES:%.cpp=%.o)
118 LIB_OBJS_G = $(COMPOSITE_SOURCES:%.cpp=$(OBJ_DIR_G)/%.o)
119 DUMMIES = $(DUMMYDIR)/osfcn.h
121 executable : $(ALL_FILES) normal
123 normal : $(OBJ_DIR)/$(TARGET)
125 debug : $(OBJ_DIR_G)/$(TARGET)
128 $(MAKE) -f makefile.unix $(MFLAGS) COMPILER=SUN_4_2 normal
131 $(MAKE) -f makefile.unix $(MFLAGS) COMPILER=EGCS_1_0_2 normal
133 $(DUMMYDIR)/osfcn.h :
134 @- sh -c 'if test ! -d "$(@D)"; then echo mkdir -p "$(@D)"; mkdir -p "$(@D)"; fi'
136 @- sh -c 'echo "extern \"C\" int read(int, char *, int);" > "$@"'
137 @- sh -c 'chmod -w "$@"'
139 $(SRCDIR)/%.cxx : %.l
140 @- if test ! -d $(@D); then echo mkdir -p $(@D); mkdir -p $(@D); else $(RM) -f $(@D)/$*.cxx; fi
141 - $(LEX) $(LEX_FLAGS) $*.l
142 @- mv -f lex.yy.c $(@D)/$*.cxx
143 @- chmod -w $(@D)/$*.cxx
145 $(SRCDIR)/%.cxx $(SRCDIR)/%.hxx : %.y
146 @- if test ! -r $(@D); then echo mkdir -p $(@D); mkdir -p $(@D); else $(RM) -f $(@D)/$*.output $(@D)/$*.cxx $(@D)/$*.hxx; fi
147 - $(YACC) $(YACC_FLAGS) $*.y
148 @- mv -f y.tab.c $(@D)/$*.cxx
149 @- mv -f y.tab.h $(@D)/$*.hxx
150 @- mv -f y.output $(@D)/$*.output
151 @- chmod -w $(@D)/$*.cxx $(@D)/$*.hxx $(@D)/$*.output
153 $(OBJ_DIR)/%.o : %.cpp
154 @- if test ! -d $(@D); then echo mkdir -p $(@D); mkdir -p $(@D); fi
156 @- cd $(OBJ_DIR) ; if $(CC) -c -O $(CFLAGS) $(CC_INCS) $(CC_DEFS) -o $*.o ../$< ;\
157 then : ; else $(RM) -f $*.o; fi
159 $(OBJ_DIR_PI)/%.o : %.cpp
160 @- if test ! -d $(@D); then echo mkdir -p $(@D); mkdir -p $(@D); fi
162 @- cd $(OBJ_DIR_PI) ; if $(CC) -c -O $(_PIC) $(CFLAGS) $(CC_INCS) $(CC_DEFS) -o $*.o ../$< ;\
163 then : ; else $(RM) -f $*.o; fi
165 $(OBJ_DIR_G)/%.o : %.cpp
166 @- if test ! -d $(@D); then echo mkdir -p $(@D); mkdir -p $(@D); fi
168 @- cd $(OBJ_DIR_G) ; if $(CC) -c $(_G) $(CFLAGS) $(CC_INCS) $(CC_DEFS) -o $*.o ../$< ;\
169 then : ; else $(RM) -f $*.o; fi
171 $(OBJ_DIR_PI_G)/%.o : %.cpp
172 @- if test ! -d $(@D); then echo mkdir -p $(@D); mkdir -p $(@D); fi
174 @- cd $(OBJ_DIR_PI_G) ; if $(CC) -c $(_PIC) $(_G) $(CFLAGS) $(CC_INCS) $(CC_DEFS) -o $*.o ../$< ;\
175 then : ; else $(RM) -f $*.o; fi
177 $(TARGET) : makefile $(LIB_OBJS:%.o=$(OBJ_DIR)/%.o)
178 @- if test ! -d $(@D); then echo mkdir -p $(@D); mkdir -p $(@D); fi
180 - cd $(OBJ_DIR) ; $(LINK) $(CFLAGS) $(CC_INCS) $(CC_DEFS) -o ../$(TARGET) -Bstatic \
181 $(LIB_OBJS) $(LINK_LIBS)
183 $(OBJ_DIR)/$(TARGET) : makefile $(LIB_OBJS:%.o=$(OBJ_DIR)/%.o)
184 @- if test ! -d $(@D); then echo mkdir -p $(@D); mkdir -p $(@D); else rm -f $@; fi
186 - cd $(OBJ_DIR) ; $(LINK) $(CFLAGS) $(CC_INCS) $(CC_DEFS) -o $(TARGET) $(LIB_OBJS) $(LINK_LIBS)
188 $(OBJ_DIR_G)/$(TARGET) : makefile $(LIB_OBJS:%.o=$(OBJ_DIR_G)/%.o)
189 @- if test ! -d $(@D); then echo mkdir -p $(@D); mkdir -p $(@D); else rm -f $@; fi
191 - cd $(OBJ_DIR_G) ; $(LINK) $(CFLAGS) $(CC_INCS) $(CC_DEFS) $$(_G) -o $(TARGET) $(LIB_OBJS) $(LINK_LIBS)
193 source_kit : CxxSrc.tgz
195 CxxSrc.tgz : CxxSrc.tar
197 - gzip CxxSrc.tar -c > $@
200 CxxSrc.tar : $(ALL_FILES) FORCE $(OBJ_DIR)/grammar
202 @- tar cf "$@" $(ALL_FILES:%="$(MAKE_TAR_PATH)%") "$(MAKE_TAR_PATH)$(OBJ_DIR)/grammar"
205 $(TAR_FILE) : $(ALL_FILES) FORCE
206 @- cd $(@D); tar rf $(@F) $(ALL_FILES:%=$(MAKE_TAR_PATH)%)
214 - $(RM) -f $(DUMMYDIR)/* $(SRCDIR)/* $(OBJ_DIR)/*.o $(OBJ_DIR_PI)/*.o $(OBJ_DIR_G)/*.o $(OBJ_DIR_PI_G)/*.o
217 - $(RM) -rf $(DUMMYDIR) $(SRCDIR) $(OBJ_DIR) $(OBJ_DIR_PI) $(OBJ_DIR_G) $(OBJ_DIR_PI_G)
219 $(OBJ_DIR)/CxxLexer.o $(OBJ_DIR_PI)/CxxLexer.o $(OBJ_DIR_G)/CxxLexer.o $(OBJ_DIR_PI_G)/CxxLexer.o : \
220 CxxLexing.cxx CxxLexing.hxx CxxToken.hxx $(SRCDIR)/CxxLexer.cxx $(SRCDIR)/CxxParser.hxx $(DUMMIES)
221 $(OBJ_DIR)/CxxParser.o $(OBJ_DIR_PI)/CxxParser.o $(OBJ_DIR_G)/CxxParser.o $(OBJ_DIR_PI_G)/CxxParser.o : \
222 CxxParsing.cxx CxxParsing.hxx CxxToken.hxx $(SRCDIR)/CxxParser.cxx $(SRCDIR)/CxxParser.hxx
223 $(OBJ_DIR)/CxxToken.o $(OBJ_DIR_PI)/CxxToken.o $(OBJ_DIR_G)/CxxToken.o $(OBJ_DIR_PI_G)/CxxToken.o : \
224 CxxToken.cxx CxxToken.hxx