petit: make argument of Write const
[omega.git] / Makefile.rules
blob5b276bf0cc0ac29db8c6b0912625ed80ab70bbbd
1 # Makefile rules for release 1.0 of the omega system
2 # DON'T EDIT -- put any locally required changes in Makefile.config.
3 # See INSTALL for more details.
5 include $(BASEDIR)/Makefile.config
8 # Provide reasonable defaults for all the things you can specify in
9 # Makefile.config
14 SUBMAKE=$(MAKE)
16 STD_INCL_PATH= -I$(BASEDIR)/basic/include -I../include
17 STD_LIB_PATH= 
18 STD_LIBS= -lm
19 STD_CFLAGS=-DOMIT_QUANTIFY_CALLS
21 TMP_REQ_INCL_PATH= $(REQUIRED:%=-I$(BASEDIR)/%/include)
22 REQ_INCL_PATH= $(TMP_REQ_INCL_PATH:%/omega/include=%/omega_lib/include)
23 TMP_REQ_LIB_PATH= $(REQUIRED:%=-L$(BASEDIR)/%/obj)
24 REQ_LIB_PATH= $(TMP_REQ_LIB_PATH:%/omega/obj=%/omega_lib/obj)
25 REQ_LIBS= $(REQUIRED:%=-l%)
27 INCL_PATH=$(STD_INCL_PATH) $(REQ_INCL_PATH) $(TARGET_INCL_PATH) $(EXTRA_INCL_PATH) $(X11_INCL_PATH) $(OS_INCL_PATH)
29 LIB_PATH=$(STD_LIB_PATH) $(REQ_LIB_PATH) $(TARGET_LIB_PATH) $(EXTRA_LIB_PATH) $(X11_LIB_PATH) $(OS_LIB_PATH)
30 # $(X11_LIBS) is not included here; if the application needs it, it should
31 # add it to TARGET_LIBS
32 LIBS=$(REQ_LIBS) $(STD_LIBS) $(TARGET_LIBS) $(OS_LIBS) $(EXTRA_LIBS)
34 CFLAGS=$(STD_CFLAGS) $(OPTIMIZATION_CFLAGS) $(COMPILER_CFLAGS) $(OS_CFLAGS) $(TARGET_CFLAGS) $(INCL_PATH)
35 LDFLAGS=$(STD_LDFLAGS) $(OPTIMIZATION_CFLAGS) $(TARGET_LDFLAGS) $(LIB_PATH) $(LIBS)
37 ALLDIRS=omega_lib omega_calc petit uniform code_gen basic
38 #ALLDIRS=omega_lib omega_calc petit code_gen basic
40 # Executable target; can have only one per directory 
41 .executable: required_libs $(OBJS)
42         $(CC) $(CFLAGS) $(OBJS) $(LDFLAGS) -o $(TARGET)
43         touch .executable
46 # Library target; can have only one per directory 
47 .library: $(OBJS)
48         $(AR_COMMAND)
49         $(RANLIB) $(TARGET)
50         touch .library
52 required_libs: always
53         @for libname in $(REQUIRED) ; do\
54           libdir=`echo $$libname | sed 's/omega/omega_lib/g'` ; \
55           if test -d $(BASEDIR)/$$libdir ; \
56           then \
57             cd $(BASEDIR)/$$libdir/obj; $(SUBMAKE) lib$$libname.a ; \
58           else \
59             echo "ERROR: ${TARGET} requires omega/$$libdir: not found!"; \
60             exit 1; \
61           fi \
62         done
64 depend_self: always
65         cp /dev/null Makefile.deps
66         $(MAKEDEPEND) $(INCL_PATH) -fMakefile.deps $(SRCS) > /dev/null 2>1
68 depend_library: depend_self
70 depend_executable: depend_self
71         @for libname in $(REQUIRED) ; \
72         do \
73           libdir=`echo $$libname | sed 's/omega/omega_lib/g'` ; \
74           if test -d $(BASEDIR)/$$libdir/obj ; \
75           then \
76             echo "Makedepend for $$libdir:" ; \
77             cd $(BASEDIR)/$$libdir/obj; $(SUBMAKE) depend ; \
78           else \
79             echo "WARNING: ${TARGET} requires omega/$$libdir: not found!";\
80           fi \
81         done
84 depend_all:
85         @cd $(BASEDIR) ; \
86         for dirname in $(ALLDIRS) ; \
87         do \
88           if test -d $$dirname/obj ; \
89           then \
90             echo "Makedepend in $$dirname:" ; \
91             cd $$dirname/obj ; \
92                  $(SUBMAKE) depend_self ; \
93                  cd ../../ ; \
94           else \
95             if test $$dirname != "basic" ; then \
96               echo "$(BASEDIR)/$$dirname/obj not found, continuing." ; \
97             fi \
98           fi \
99         done
101 clean_all:
102         @cd $(BASEDIR) ; \
103         for dirname in $(ALLDIRS) ; \
104         do \
105           if test -d $$dirname/obj ; \
106           then \
107             echo "Clean in $$dirname:" ; \
108             cd $$dirname/obj ; \
109                  $(SUBMAKE) clean ; \
110                  cd ../../ ; \
111           else \
112             if test $$dirname != "basic" ; then \
113               echo "$(BASEDIR)/$$dirname/obj not found, continuing." ; \
114             fi \
115           fi \
116         done
118 veryclean_all:
119         @cd $(BASEDIR) ; \
120         for dirname in $(ALLDIRS) ; \
121         do \
122           if test -d $$dirname/obj ; \
123           then \
124             echo "Clean in $$dirname:" ; \
125             cd $$dirname/obj ; \
126                  $(SUBMAKE) veryclean ; \
127                  cd ../.. ; \
128           else \
129             if test $$dirname != "basic" ; then \
130               echo "$(BASEDIR)/$$dirname/obj not found, continuing." ; \
131             fi \
132           fi \
133         done
136 clean_self: always
137         -$(RM) -f *.o *.o.li *.typ *.val petit[yl].[ch] hpp[yl].[ch] .tables .executable .library TAGS  < /dev/null 2> /dev/null
139 veryclean_self: clean
140         -$(RM) -f *.a $(TARGET)
142 install_all: install_basic 
143         @cd $(BASEDIR) ; \
144         for dirname in $(ALLDIRS) ; do \
145           if test -d $$dirname/obj ; \
146           then \
147             echo "Installing in $$dirname:" ; \
148             cd $$dirname/obj; \
149                 $(SUBMAKE) install ; \
150                 cd ../.. ; \
151           else \
152             if test $$dirname != "basic" ; then \
153               echo "Warning: $$dirname not found, not installed." ;\
154             fi \
155           fi \
156         done
158 install_basic: include_exists
159         @echo "Installing in basic:"
160         cd $(BASEDIR)/basic/include; \
161         tar cf - basic | (cd $(INCL_DESTDIR); tar xf -)
164 install_library: lib_exists
165         $(CP) -p $(TARGET) $(LIB_DESTDIR)
167 install_includes: include_exists
168         cd ../include; \
169         tar cf - $(LIB) | (cd $(INCL_DESTDIR); tar xf -)
171 install_executable: bin_exists
172         $(CP) $(TARGET) $(BIN_DESTDIR)
175 include_exists: always
176         @if test ! -d $(INCL_DESTDIR) ; then \
177            mkdir $(INCL_DESTDIR); \
178         fi
179         @if test ! -w $(INCL_DESTDIR) ; then \
180            echo "ERROR: $(INCL_DESTDIR) is not writable."; \
181            exit 1; \
182         fi
184 lib_exists: always
185         @if test ! -d $(LIB_DESTDIR) ; then \
186            mkdir $(LIB_DESTDIR); \
187         fi
188         @if test ! -w $(LIB_DESTDIR) ; then \
189            echo "ERROR: $(LIB_DESTDIR) is not writable."; \
190            exit 1; \
191         fi
193 bin_exists: always
194         @if test ! -d $(BIN_DESTDIR) ; then \
195           mkdir $(BIN_DESTDIR) ;\
196         fi
197         @if test ! -w $(BIN_DESTDIR) ; then \
198            echo "ERROR: $(BIN_DESTDIR) is not writable."; \
199            exit 1; \
200         fi
202 # Implicit rules: make C files in ../src/ directory
204 %.o: ../src/%.c
205         $(CC) $(CFLAGS) -c $<
207 %.o: %.c
208         $(CC) $(CFLAGS) -c $<
211 #Special rule for .c files in basic directory, ConstString and Link
212 %.o: $(BASEDIR)/basic/src/%.c
213         $(CC) $(CFLAGS) -c $< 
215 y.tab.c: ../src/parser.y
216         ${RUMINANT} -v -d ../src/parser.y
218 y.tab.h: y.tab.c
220 lex.yy.c: ../src/parser.l y.tab.h
221         $(LEX) -i ../src/parser.l
223 PT.o : ../src/PT.c
224         ${CC} ${CFLAGS} -w -c ../src/PT.c
226 always:
229 # The target "check_order" verifies that it's possible to get an ordering
230 # of routines in the library that will work with the single-pass UNIX linker.
231 # This is time consuming, and only necessary if you've extended the library in
232 # some way. 
234 # "gegrep" is GNU egrep
236 check_order : ubiquitous.names
237         bin/lorder ${OC_OBJ} | tsort > /dev/null
238         @echo " " ; echo "      NOTE: this takes about 11 minutes of CPU time on our SPARC-10" ; echo " "
239         bin/lorder -x ubiquitous.names ${PRES_OBJ} ${REL_OBJ} ${FANCY_OBJ} | tsort > /dev/null
241 ubiquitous.names : lib_hack.o
242         nm lib_hack.o | gegrep -v '^........ d' | cut -c14- > ubiquitous.names
244 always:
246 oldmake: always
247         ln -s ../src/*.[chly] .
249 -include Makefile.deps