1 | THIS=AISC/Makefile |
---|
2 | MAKETHIS=$(MAKE) -f $(THIS) |
---|
3 | #MAKETHIS=$(MAKE) -d -f $(THIS) |
---|
4 | SED:=$(ARBHOME)/SH/arb_sed |
---|
5 | READLINK:=$(ARBHOME)/SH/arb_readlink |
---|
6 | |
---|
7 | .SUFFIXES: .o .c .h .aisc |
---|
8 | |
---|
9 | #where to find the creator files |
---|
10 | AISC=../AISC/aisc |
---|
11 | AISC_MKPT = ../AISC_MKPTPS/aisc_mkpt |
---|
12 | |
---|
13 | RUN_AISC:=$(AISC) |
---|
14 | # valgrinding like this breaks the build process (due to wrong exitcode) |
---|
15 | #RUN_AISC:=arb_valgrind -c 15 $(AISC) |
---|
16 | #RUN_AISC:=arb_valgrind -c 15 -l $(AISC) |
---|
17 | #RUN_AISC:=arb_valgrind -c 15 -l -r $(AISC) |
---|
18 | |
---|
19 | GEN_INCLUDES = GENH/aisc.h GENH/aisc_com.h |
---|
20 | INCLUDE_INCLUDES = aisc_include.header |
---|
21 | |
---|
22 | SERVER_OBJECTS = O/server.o O/struct_man.o O/aisc_extern.o |
---|
23 | |
---|
24 | GEN_SERVER_PROTO_OBJECTS = GENC/aisc_server.o |
---|
25 | GEN_SERVER_OTHER_OBJECTS = GENC/aisc_global.o |
---|
26 | GEN_SERVER_OBJECTS = $(GEN_SERVER_PROTO_OBJECTS) $(GEN_SERVER_OTHER_OBJECTS) |
---|
27 | |
---|
28 | GEN_SERVER_PROTO_SOURCES = $(GEN_SERVER_PROTO_OBJECTS:.o=.c) |
---|
29 | GEN_SERVER_SOURCES = $(GEN_SERVER_OBJECTS:.o=.c) |
---|
30 | |
---|
31 | GEN_SERVER_INCLUDES = C/aisc_server.h |
---|
32 | GEN_SERVER_PROTO = GENH/aisc_server_proto.h |
---|
33 | GEN_SERVER_EXTERN_PROTO = GENH/aisc_server_extern.h |
---|
34 | |
---|
35 | SERVER_INCLUDES = $(GEN_INCLUDES) $(GEN_SERVER_INCLUDES) $(GEN_SERVER_PROTO) $(GEN_SERVER_EXTERN_PROTO) |
---|
36 | |
---|
37 | CLIENT_OBJECTS = O/client.o |
---|
38 | CLIENT_INCLUDES = $(GEN_INCLUDES) C/client_privat.h C/client.h |
---|
39 | |
---|
40 | COMMON_OBJECTS = |
---|
41 | COMMON_INCLUDES = |
---|
42 | |
---|
43 | AISC_EXTERNALS = C/aisc_extern.c $(PRIVATE_SERVER_OBJECTS:.o=.c) |
---|
44 | GLOBALS_AISC = GENH/global.aisc |
---|
45 | |
---|
46 | AISC_DEPENDS = AISC/*.pa $(MAIN_SOURCE) $(AISC) $(DUMPDIR) $(GLOBALS_AISC) |
---|
47 | |
---|
48 | IMPORT_PROTO = GENH/import_proto.h |
---|
49 | |
---|
50 | SERVER = server.a |
---|
51 | CLIENT = client.a |
---|
52 | |
---|
53 | AISC_SERVER_EXTERN = GENH/aisc_server_extern.aisc |
---|
54 | |
---|
55 | DUMPDIR=DUMP |
---|
56 | |
---|
57 | LINK_TO_OTHER_ARB=~/ARB.aisc_regression_test_vs# create this as symlink to other ARB checkout to activate regression test |
---|
58 | FAIL_ON_CHANGE=1# 0=continue on change, 1=fail on change |
---|
59 | |
---|
60 | # ---------------------------------------- |
---|
61 | |
---|
62 | COMPARE_WITH_OTHER_ARB:=$(shell $(READLINK) $(LINK_TO_OTHER_ARB)) |
---|
63 | ifneq ($(COMPARE_WITH_OTHER_ARB),) |
---|
64 | THIS__COMDIR=$(shell pwd) |
---|
65 | COMDIRNAME=$(subst $(ARBHOME),,$(THIS__COMDIR)) |
---|
66 | OTHER_COMDIR=$(subst //,/,$(COMPARE_WITH_OTHER_ARB)/$(COMDIRNAME)) |
---|
67 | ifeq ($(FAIL_ON_CHANGE),0) |
---|
68 | REGR_FAILURE=(echo "$(THIS):57: Warning: regression on generated code (ignored)" || true) |
---|
69 | else |
---|
70 | REGR_FAILURE=( echo "$(THIS):59: Error: regression on generated AISC code"; \ |
---|
71 | rm $(SERVER) $(CLIENT) $(COMMON); \ |
---|
72 | false) |
---|
73 | endif |
---|
74 | endif |
---|
75 | |
---|
76 | # ---------------------------------------- |
---|
77 | |
---|
78 | ifeq ($(AUTODEPENDS),1) |
---|
79 | all: |
---|
80 | +test -f .depends || $(MAKETHIS) "AUTODEPENDS=0" .depends |
---|
81 | +$(MAKETHIS) "AUTODEPENDS=2" all |
---|
82 | else |
---|
83 | all: directories |
---|
84 | +$(MAKETHIS) realall |
---|
85 | |
---|
86 | endif |
---|
87 | |
---|
88 | realall: $(CLIENT) $(SERVER) $(COMMON) Makefile $(THIS) |
---|
89 | ifeq ($(COMPARE_WITH_OTHER_ARB),) |
---|
90 | @echo "AISC regression tests are disabled ($(LINK_TO_OTHER_ARB) not found from AISC_COM/$(THIS))" |
---|
91 | else |
---|
92 | ifeq ($(THIS__COMDIR),$(OTHER_COMDIR)) |
---|
93 | @echo "$(THIS):63: Warning: Skipping AISC regression tests (test versus self always ok)" |
---|
94 | else |
---|
95 | @echo "Running AISC regression tests (versus $(COMPARE_WITH_OTHER_ARB))" |
---|
96 | # compare generated code using ../../SOURCE_TOOLS/check_dirs_equal.sh |
---|
97 | @( \ |
---|
98 | ../SOURCE_TOOLS/check_dirs_equal.sh $(THIS__COMDIR)/GENC $(OTHER_COMDIR)/GENC '*.c' && \ |
---|
99 | ../SOURCE_TOOLS/check_dirs_equal.sh $(THIS__COMDIR)/GENH $(OTHER_COMDIR)/GENH '*.h' && \ |
---|
100 | ../SOURCE_TOOLS/check_dirs_equal.sh $(THIS__COMDIR)/DUMP $(OTHER_COMDIR)/DUMP '*.dump' && \ |
---|
101 | echo "No change in generated code" \ |
---|
102 | ) || $(REGR_FAILURE) |
---|
103 | endif |
---|
104 | endif |
---|
105 | |
---|
106 | pregenerate: $(GEN_SERVER_SOURCES) $(SERVER_INCLUDES) $(CLIENT_INCLUDES) $(AISC_EXTERNALS) |
---|
107 | |
---|
108 | directories: |
---|
109 | @mkdir -p GENH GENC O DUMP |
---|
110 | |
---|
111 | GENH: directories |
---|
112 | GENC: directories |
---|
113 | O: directories |
---|
114 | DUMP: directories |
---|
115 | |
---|
116 | $(SERVER): $(SERVER_OBJECTS) $(GEN_SERVER_OBJECTS) $(PRIVATE_SERVER_OBJECTS) |
---|
117 | $(LINK_STATIC_LIB) $@ $^ |
---|
118 | |
---|
119 | $(CLIENT): $(CLIENT_OBJECTS) $(GEN_CLIENT_OBJECTS) |
---|
120 | $(LINK_STATIC_LIB) $@ $^ |
---|
121 | |
---|
122 | $(COMMON): $(COMMON_OBJECTS) |
---|
123 | $(LINK_STATIC_LIB) $@ $^ |
---|
124 | |
---|
125 | $(GEN_SERVER_OBJECTS) $(PRIVATE_SERVER_OBJECTS): $(SERVER_INCLUDES) $(GEN_SERVER_SOURCES) $(PRIVATE_SERVER_OBJECTS:.o=.c) |
---|
126 | $(COMPILER) -c -o $@ $(@:.o=.c) -IGENH -I. -IC -DAISC_SAVE_$(AISC_SAVE) $(POST_COMPILE) |
---|
127 | |
---|
128 | O/%.o: C/%.c $(GEN_INCLUDES) $(CLIENT_INCLUDES) C/server.h |
---|
129 | $(COMPILER) -c -o $@ $< -IGENH -I. -IC $(POST_COMPILE) |
---|
130 | |
---|
131 | $(CLIENT_OBJECTS): $(CLIENT_OBJECTS:O/%.o=C/%.c) $(GEN_INCLUDES) $(CLIENT_INCLUDES) |
---|
132 | $(CLIENTCOMPILER) -c -o $@ C/$(@F:.o=.c) -IGENH -I. -IC $(POST_COMPILE) |
---|
133 | |
---|
134 | $(DUMPDIR): |
---|
135 | mkdir -p $(DUMPDIR) |
---|
136 | |
---|
137 | $(GLOBALS_AISC).tmp: |
---|
138 | @echo "AISC_SAVE $(AISC_SAVE);" > $@ |
---|
139 | |
---|
140 | $(GLOBALS_AISC): $(GLOBALS_AISC).tmp |
---|
141 | $(ARBHOME)/SOURCE_TOOLS/mv_if_diff $(GLOBALS_AISC).tmp $(GLOBALS_AISC) |
---|
142 | |
---|
143 | GENH/%.h: AISC/%.pa $(AISC_DEPENDS) $(INCLUDE_INCLUDES) |
---|
144 | $(RUN_AISC) $< $(MAIN_SOURCE) $@ |
---|
145 | |
---|
146 | GENC/%.c: AISC/%.pa $(AISC_DEPENDS) $(AISC_SERVER_EXTERN) $(GEN_SERVER_INCLUDES) |
---|
147 | $(RUN_AISC) $< $(MAIN_SOURCE) $@ $(AISC_SERVER_EXTERN) $(IMPORT_PROTO) $(GLOBALS_AISC) |
---|
148 | |
---|
149 | $(IMPORT_PROTO): $(GEN_SERVER_PROTO_SOURCES) |
---|
150 | echo $@ |
---|
151 | |
---|
152 | $(AISC_SERVER_EXTERN): $(AISC_EXTERNALS) $(AISC_MKPT) $(THIS) |
---|
153 | rm -f $(AISC_SERVER_EXTERN) |
---|
154 | $(AISC_MKPT) -a $(AISC_EXTERNALS) >$@ |
---|
155 | |
---|
156 | $(GEN_SERVER_EXTERN_PROTO): $(AISC_EXTERNALS) $(AISC_MKPT) $(THIS) |
---|
157 | rm -f $(GEN_SERVER_EXTERN_PROTO) |
---|
158 | $(AISC_MKPT) -w $(subst GENH/,,$@) $(AISC_EXTERNALS) >$@ |
---|
159 | |
---|
160 | $(GEN_SERVER_PROTO): $(GEN_SERVER_PROTO_SOURCES) $(AISC_MKPT) $(THIS) |
---|
161 | rm -f $@ |
---|
162 | $(AISC_MKPT) -w $(subst GENH/,,$@) $(GEN_SERVER_PROTO_SOURCES) >$@ |
---|
163 | |
---|
164 | clean: |
---|
165 | @rm -f *.[ao] */*.[ao] |
---|
166 | @rm -rf GENH GENC DUMP O |
---|
167 | @rm -f .depends |
---|
168 | |
---|
169 | .depends: |
---|
170 | $(MAKEDEPEND) $(MAKEDEPENDFLAGS) C/*.c GENC/*.c -I GENH -I C -f- -w1 2>/dev/null \ |
---|
171 | | grep -v ' /usr' \ |
---|
172 | | $(SED) -e 's/^C/O/ig' \ |
---|
173 | > .depends_new |
---|
174 | $(ARBHOME)/SOURCE_TOOLS/mv_if_diff .depends_new .depends |
---|
175 | |
---|
176 | ifeq ($(AUTODEPENDS),2) |
---|
177 | include .depends |
---|
178 | endif |
---|