refactor Makefiles
[prop.git] / prop-src / Makefile
blobe7beb95eef3b313361239c93905aa43f17ddf292
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 COPTS = /EHsc /nologo
16 #LDOPTS = -lg++
17 CFLAGS = $(CC_INCLUDE) $(COPTS)
18 #LINKFLAGS = -L../lib -lprop $(LDOPTS) -lm
19 LINKFLAGS = /LIBPATH:../lib-src libprop.lib
21 OUTPUT := prop$(DOTEXE)
24 # These are the prop include files
26 PROP_H_SRC= \
27 ir.ph ast.ph basics.ph parsegen.ph keywords.ph parser.ph \
28 collection.ph setl-ast.ph setlgen.ph matchcom.ph \
29 trs.ph timespace.ph env.ph funmap.ph metasyntax.ph \
30 pat.ph list.ph grsgen.ph graphtype.ph graphedges.ph \
31 aggen.ph datatype.ph listimpl.ph rwmix.ph
32 # dataflow.ph bitfield.ph wam.ph constraint.ph logicgen.ph
35 # These are the prop source files
37 PROP_C_SRC= \
38 persistgen.pcc gcgen.pcc printgen.pcc \
39 matchcom.pcc matchgen.pcc infgen.pcc type.pcc \
40 printing.pcc datagen.pcc codegen.pcc compiler.pcc indexing.pcc \
41 ast.pcc constr.pcc parsegen.pcc lexeme.pcc lexer.pcc \
42 trs.pcc trs2.pcc trs3.pcc \
43 rwgen.pcc rwgen2.pcc rwgen3.pcc rwgen4.pcc rwgen5.pcc \
44 lawgen.pcc parser-util.pcc parser.pcc setl-ast.pcc \
45 documentation.pcc collection.pcc setlgen.pcc setltype.pcc \
46 timespace.pcc env.pcc funmap.pcc metasyntax.pcc \
47 pat.pcc grsgen.pcc selector.pcc \
48 graphtype.pcc graphrep.pcc graphops.pcc graphreport.pcc \
49 classdef.pcc prop-main.pcc \
50 aggen.pcc datatype.pcc instance.pcc list.pcc \
51 visualize.pcc visual2.pcc rwmix.pcc
52 # dataflow.pcc bitfield.pcc constraint.pcc logicgen.pcc wam.pcc
55 # These are the normal .h files (not generated by prop)
57 NORMAL_H_SRC= author.h automake.h classdef.h codegen.h compiler.h \
58 config.h datagen.h functortab.h hashtab.h infgen.h labelgen.h \
59 options.h rwgen.h textbuf.h type.h visualize.h
61 # These are the normal .cc files (not generated by prop)
63 NORMAL_C_SRC= automake.cc frontend.cc functortab.cc \
64 hashtab.cc labelgen.cc options.cc \
65 patchlev.cc patenv.cc process.cc textbuf.cc
68 # .h files generated by prop
70 GEN_H_SRC=$(PROP_H_SRC:.ph=.h)
73 # .cc files generated by prop
75 GEN_C_SRC=$(PROP_C_SRC:.pcc=.cc)
78 # all files generated by prop
80 GEN_SRC= $(GEN_H_SRC) $(GEN_C_SRC)
83 # all .h files
85 H_SRC= $(GEN_H_SRC) $(NORMAL_H_SRC)
88 # all .cc files
90 C_SRC= $(GEN_C_SRC) $(NORMAL_C_SRC)
93 # all files
95 SRC= $(H_SRC) $(C_SRC)
98 # all object files
100 OBJS = $(patsubst %.cc,%.$(OBJ),$(C_SRC))
103 # How to build prop
105 $(OUTPUT): $(OBJS)
106 $(call MKEXE,$@,$(OBJS) $(LINKFLAGS))
107 # strip $@
110 # Regenerate source only
112 src: $(SRC)
114 debug: $(SRC) $(OBJS)
115 $(CC) $(OBJS) -g -o $(OUTPUT) $(LINKFLAGS)
117 profile: $(SRC) $(OBJS)
118 $(CC) $(OBJS) -pg -g -o $(OUTPUT) $(LINKFLAGS)
120 tar:
121 tar -cvf - [a-z]*.h [a-z]*.cc [a-z]*.[ply]* *.tex \
122 banner testprop testprop2 Makefile README \
123 | gzip >prop-2.1.tar.gz
126 # Remove object files only
128 clean:
129 $(RM) *.$(OBJ)
132 # Remove object files and prop binary
134 cleanall: clean
135 $(RM) $(OUTPUT)
138 # Remove all object files and generated code
140 spotless: cleanall
141 $(RM) $(GEN_SRC)
143 depends1:
144 touch depends1
145 depends2:
146 touch depends2
148 classes:
149 @awk 'BEGIN { printf "Number of classes = "; }' </dev/null
150 @grep "^class " *.h | grep -v ";" | wc -l
152 test: test1
154 test1:
155 ./testprop
156 test2:
157 ./testprop2
160 wc [a-z]*.pcc [a-z]*.ph
161 genwc:
162 wc $(GEN_SRC)
165 # Generate dependencies
167 depends:
168 @echo Remaking prop dependency
169 $(PROP) -M $(PROP_OPTS) $(PROP_C_SRC) $(PROP_H_SRC) >depends1 || rm -f depends1
170 @echo Remaking g++ dependency
171 $(CC) -MM $(CFLAGS) $(C_SRC) >depends2 || rm -f depends2
173 #include depends1
174 #include depends2
176 T%.cc: T%.pcc
177 $(PROP) $(PROP_OPTS_BASIC) $<
178 %.h: %.ph
179 $(PROP) $(PROP_OPTS) $<
180 %.cc: %.pcc
181 $(PROP) $(PROP_OPTS) $<
182 %.$(OBJ): %.cc
183 $(call MKOBJ,$@,$(CFLAGS) $<)
185 T%: T%.cc
186 $(CC) $@.cc -o $@ -O6 $(CFLAGS) $(LINKFLAGS)