simple.cc - generated code example
[prop.git] / prop-src / Makefile
blobaa08ff1b5c220e3849a7551015f24874c2736d1d
1 ###############################################################################
3 # Makefile for compiling Prop 2.3.x
5 ###############################################################################
7 include ../Makefile.config
9 PROP = ../bin/prop
10 PROP_OPTS_BASIC = -strict $(CC_INCLUDE) -save_space -report -v2
11 PROP_OPTS = $(PROP_OPTS_BASIC) -O14
13 CC_INCLUDE = -I../include
14 #COPTS = -O6 -pedantic
15 #LDOPTS = -lg++
16 CFLAGS = $(CC_INCLUDE) $(CPP_OPTS)
17 LINKFLAGS = -L../lib -lprop $(LDOPTS) -lm
18 #LINKFLAGS = /LIBPATH:../lib-src libprop.lib
20 OUTPUT := prop$(DOTEXE)
23 # These are the prop include files
25 PROP_H_SRC= \
26 ir.ph ast.ph basics.ph parsegen.ph keywords.ph parser.ph \
27 collection.ph setl-ast.ph setlgen.ph matchcom.ph \
28 trs.ph timespace.ph env.ph funmap.ph metasyntax.ph \
29 pat.ph list.ph grsgen.ph graphtype.ph graphedges.ph \
30 aggen.ph datatype.ph listimpl.ph rwmix.ph
31 # dataflow.ph bitfield.ph wam.ph constraint.ph logicgen.ph
34 # These are the prop source files
36 PROP_C_SRC= \
37 persistgen.pcc gcgen.pcc printgen.pcc \
38 matchcom.pcc matchgen.pcc infgen.pcc type.pcc \
39 printing.pcc datagen.pcc codegen.pcc compiler.pcc indexing.pcc \
40 ast.pcc constr.pcc parsegen.pcc lexeme.pcc lexer.pcc \
41 trs.pcc trs2.pcc trs3.pcc \
42 rwgen.pcc rwgen2.pcc rwgen3.pcc rwgen4.pcc rwgen5.pcc \
43 lawgen.pcc parser-util.pcc parser.pcc setl-ast.pcc \
44 documentation.pcc collection.pcc setlgen.pcc setltype.pcc \
45 timespace.pcc env.pcc funmap.pcc metasyntax.pcc \
46 pat.pcc grsgen.pcc selector.pcc \
47 graphtype.pcc graphrep.pcc graphops.pcc graphreport.pcc \
48 classdef.pcc prop-main.pcc \
49 aggen.pcc datatype.pcc instance.pcc list.pcc \
50 visualize.pcc visual2.pcc rwmix.pcc
51 # dataflow.pcc bitfield.pcc constraint.pcc logicgen.pcc wam.pcc
54 # These are the normal .h files (not generated by prop)
56 NORMAL_H_SRC= author.h automake.h classdef.h codegen.h compiler.h \
57 config.h datagen.h functortab.h hashtab.h infgen.h labelgen.h \
58 options.h rwgen.h textbuf.h type.h visualize.h
60 # These are the normal .cc files (not generated by prop)
62 NORMAL_C_SRC= automake.cc frontend.cc functortab.cc \
63 hashtab.cc labelgen.cc options.cc \
64 patchlev.cc patenv.cc process.cc textbuf.cc
67 # .h files generated by prop
69 GEN_H_SRC=$(PROP_H_SRC:.ph=.h)
72 # .cc files generated by prop
74 GEN_C_SRC=$(PROP_C_SRC:.pcc=.cc)
77 # all files generated by prop
79 GEN_SRC= $(GEN_H_SRC) $(GEN_C_SRC)
82 # all .h files
84 H_SRC= $(GEN_H_SRC) $(NORMAL_H_SRC)
87 # all .cc files
89 C_SRC= $(GEN_C_SRC) $(NORMAL_C_SRC)
92 # all files
94 SRC= $(H_SRC) $(C_SRC)
97 # all object files
99 OBJS = $(patsubst %.cc,%.$(OBJ),$(C_SRC))
102 # How to build prop
104 $(OUTPUT): $(OBJS)
105 $(call MKEXE,$@,$(OBJS) $(LINKFLAGS))
106 # strip $@
109 # Regenerate source only
111 src: $(SRC)
113 debug: $(SRC) $(OBJS)
114 $(CC) $(OBJS) -g -o $(OUTPUT) $(LINKFLAGS)
116 profile: $(SRC) $(OBJS)
117 $(CC) $(OBJS) -pg -g -o $(OUTPUT) $(LINKFLAGS)
119 tar:
120 tar -cvf - [a-z]*.h [a-z]*.cc [a-z]*.[ply]* *.tex \
121 banner testprop testprop2 Makefile README \
122 | gzip >prop-2.1.tar.gz
125 # Remove object files only
127 clean:
128 $(RM) $(OBJS)
131 # Remove object files and prop binary
133 cleanall: clean
134 $(RM) $(OUTPUT)
137 # Remove all object files and generated code
139 spotless: cleanall
140 $(RM) $(GEN_SRC)
142 depends1:
143 touch depends1
144 depends2:
145 touch depends2
147 classes:
148 @awk 'BEGIN { printf "Number of classes = "; }' </dev/null
149 @grep "^class " *.h | grep -v ";" | wc -l
151 test: test1
153 test1:
154 ./testprop
155 test2:
156 ./testprop2
159 wc [a-z]*.pcc [a-z]*.ph
160 genwc:
161 wc $(GEN_SRC)
164 # Generate dependencies
166 depends:
167 @echo Remaking prop dependency
168 $(PROP) -M $(PROP_OPTS) $(PROP_C_SRC) $(PROP_H_SRC) >depends1 || rm -f depends1
169 @echo Remaking g++ dependency
170 $(CC) -MM $(CFLAGS) $(C_SRC) >depends2 || rm -f depends2
172 #include depends1
173 #include depends2
175 T%.cc: T%.pcc
176 $(PROP) $(PROP_OPTS_BASIC) $<
177 %.h: %.ph
178 $(PROP) $(PROP_OPTS) $<
179 %.cc: %.pcc
180 $(PROP) $(PROP_OPTS) $<
181 %.$(OBJ): %.cc
182 $(call MKOBJ,$@,$(CFLAGS) $<)
184 T%: T%.cc
185 $(CC) $@.cc -o $@ -O6 $(CFLAGS) $(LINKFLAGS)