Merge remote branch 'master'
[prop.git] / Makefile.sample
blobb52e73ddad1f238335f9bf3103cb9dd819dc7ba8
1 ###############################################################################
3 #  Sample Makefile for compiling programs using Prop.
4 #  The places where you have to change are marked with ???
5 #  C++ files are assumed to be named as .C.
7 #  Use 'make depends' to generate file dependencies
9 ###############################################################################
11 ###############################################################################
13 #  C++ compiler setup (assume g++)
15 ###############################################################################
16 CC              = g++
17 CC_INCLUDE      = -I../include
18 CC_OPTS         = $(CC_INCLUDE) -O6 
20 ###############################################################################
22 #  Prop program setup.
23 #  The options are: use strict checking, generate report, verbose level 2.
25 ###############################################################################
26 PROP              = prop # replace with absolute path if necessary
27 PROP_OPTS         = -strict -report -v2 $(CC_INCLUDE) 
28 PROP_LIBRARY_PATH = ??? # replace with the path of the libprop.a library
30 EXTRA_LIBRARIES = ???
31 LD_OPTS         = $(EXTRA_LIBRARIES) -L$(PROP_LIBRARY_PATH) -lprop -lg++ -lm
33 ###############################################################################
35 #  This is the name of the target program
37 ###############################################################################
38 TARGET= ???
40 ###############################################################################
42 #  This is where you should put the prop include files (.ph files)
44 ###############################################################################
45 PROP_H_SRC= ???
47 ###############################################################################
49 #  This are the prop source files (.pC files)
51 ###############################################################################
52 PROP_C_SRC= ???
54 ###############################################################################
56 #  These are the normal .h files (not generated by prop)
58 ###############################################################################
59 NORMAL_H_SRC=  ???
61 ###############################################################################
63 #  These are the normal .C files (not generated by prop)
65 ###############################################################################
66 NORMAL_C_SRC=  ???
69 #  .h files generated by prop
71 GEN_H_SRC=$(PROP_H_SRC:.ph=.h)
74 #  .C files generated by prop
76 GEN_C_SRC=$(PROP_C_SRC:.pC=.C)
79 #  all files generated by prop
81 GEN_SRC=        $(GEN_H_SRC) $(GEN_C_SRC)
84 #  all .h files
86 H_SRC= $(GEN_H_SRC) $(NORMAL_H_SRC)
89 #  all .C files
91 C_SRC= $(GEN_C_SRC) $(NORMAL_C_SRC)
94 #  all files
96 SRC=    $(H_SRC) $(C_SRC)
99 #  all object files
101 OBJ =   $(C_SRC:.C=.o)
104 #  How to compile and link the program
106 all:    $(TARGET)
108 $(TARGET): $(SRC) $(OBJ)
109         $(CC) $(CC_OPTS) $(OBJ) -o $@ $(LD_OPTS)
112 #  Regenerate source only
114 src:    $(SRC)
117 #  Remove object files only
119 clean:
120         rm -f *.o
123 #  Remove all object files and generated code
125 spotless: clean
126         rm -f $(GEN_SRC)        
128 depends1:
129         touch depends1
130 depends2:
131         touch depends2
134 # Generate dependencies
136 depends: 
137         @echo Remaking prop dependency
138         $(PROP) -M $(PROP_OPTS) $(PROP_C_SRC) $(PROP_H_SRC) >depends1 || rm -f depends1
139         @echo Remaking g++ dependency
140         $(CC) -MM $(CC_OPTS) $(C_SRC) >depends2 || rm -f depends2
142 include depends1
143 include depends2
145 %.h:    %.ph
146         $(PROP) $(PROP_OPTS) $<
147 %.C:    %.pC
148         $(PROP) $(PROP_OPTS) $<
149 %.o:    %.C
150         $(CC) -c $(CC_OPTS) $<