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