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 | AISC_EXTERNALS = C/aisc_extern.c $(PRIVATE_SERVER_OBJECTS:.o=.c) |
---|
41 | GLOBALS_AISC = GENH/global.aisc |
---|
42 | |
---|
43 | AISC_DEPENDS = AISC/*.pa $(MAIN_SOURCE) $(AISC) $(DUMPDIR) $(GLOBALS_AISC) |
---|
44 | |
---|
45 | IMPORT_PROTO = GENH/import_proto.h |
---|
46 | |
---|
47 | SERVER = server.a |
---|
48 | CLIENT = client.a |
---|
49 | |
---|
50 | AISC_SERVER_EXTERN = GENH/aisc_server_extern.aisc |
---|
51 | |
---|
52 | DUMPDIR=DUMP |
---|
53 | |
---|
54 | LINK_TO_OTHER_ARB=~/ARB.aisc_regression_test_vs# create this as symlink to other ARB checkout to activate regression test |
---|
55 | FAIL_ON_CHANGE=1# 0=continue on change, 1=fail on change |
---|
56 | |
---|
57 | # ---------------------------------------- |
---|
58 | |
---|
59 | COMPARE_WITH_OTHER_ARB:=$(shell $(READLINK) $(LINK_TO_OTHER_ARB)) |
---|
60 | ifneq ($(COMPARE_WITH_OTHER_ARB),) |
---|
61 | THIS__COMDIR=$(shell pwd) |
---|
62 | COMDIRNAME=$(subst $(ARBHOME),,$(THIS__COMDIR)) |
---|
63 | OTHER_COMDIR=$(subst //,/,$(COMPARE_WITH_OTHER_ARB)/$(COMDIRNAME)) |
---|
64 | ifeq ($(FAIL_ON_CHANGE),0) |
---|
65 | REGR_FAILURE=(echo "$(THIS):57: Warning: regression on generated code (ignored)" || true) |
---|
66 | else |
---|
67 | REGR_FAILURE=( echo "$(THIS):59: Error: regression on generated AISC code"; \ |
---|
68 | rm $(SERVER) $(CLIENT) ; \ |
---|
69 | false) |
---|
70 | endif |
---|
71 | endif |
---|
72 | |
---|
73 | # ---------------------------------------- |
---|
74 | |
---|
75 | ifeq ($(AUTODEPENDS),1) |
---|
76 | all: |
---|
77 | +test -f .depends || $(MAKETHIS) "AUTODEPENDS=0" .depends |
---|
78 | +$(MAKETHIS) "AUTODEPENDS=2" all |
---|
79 | else |
---|
80 | all: directories |
---|
81 | +$(MAKETHIS) realall |
---|
82 | |
---|
83 | endif |
---|
84 | |
---|
85 | realall: $(CLIENT) $(SERVER) Makefile $(THIS) |
---|
86 | ifeq ($(COMPARE_WITH_OTHER_ARB),) |
---|
87 | @echo "AISC regression tests are disabled ($(LINK_TO_OTHER_ARB) not found from AISC_COM/$(THIS))" |
---|
88 | else |
---|
89 | ifeq ($(THIS__COMDIR),$(OTHER_COMDIR)) |
---|
90 | @echo "$(THIS):63: Warning: Skipping AISC regression tests (test versus self always ok)" |
---|
91 | else |
---|
92 | @echo "Running AISC regression tests (versus $(COMPARE_WITH_OTHER_ARB))" |
---|
93 | # compare generated code using ../../SOURCE_TOOLS/check_dirs_equal.sh |
---|
94 | @( \ |
---|
95 | ../SOURCE_TOOLS/check_dirs_equal.sh $(THIS__COMDIR)/GENC $(OTHER_COMDIR)/GENC '*.c' && \ |
---|
96 | ../SOURCE_TOOLS/check_dirs_equal.sh $(THIS__COMDIR)/GENH $(OTHER_COMDIR)/GENH '*.h' && \ |
---|
97 | ../SOURCE_TOOLS/check_dirs_equal.sh $(THIS__COMDIR)/DUMP $(OTHER_COMDIR)/DUMP '*.dump' && \ |
---|
98 | echo "No change in generated code" \ |
---|
99 | ) || $(REGR_FAILURE) |
---|
100 | endif |
---|
101 | endif |
---|
102 | |
---|
103 | pregenerate: $(GEN_SERVER_SOURCES) $(SERVER_INCLUDES) $(CLIENT_INCLUDES) $(AISC_EXTERNALS) |
---|
104 | |
---|
105 | directories: |
---|
106 | @mkdir -p GENH GENC O DUMP |
---|
107 | |
---|
108 | GENH: directories |
---|
109 | GENC: directories |
---|
110 | O: directories |
---|
111 | DUMP: directories |
---|
112 | |
---|
113 | $(SERVER): $(SERVER_OBJECTS) $(GEN_SERVER_OBJECTS) $(PRIVATE_SERVER_OBJECTS) |
---|
114 | $(LINK_STATIC_LIB) $@ $^ |
---|
115 | |
---|
116 | $(CLIENT): $(CLIENT_OBJECTS) |
---|
117 | $(LINK_STATIC_LIB) $@ $^ |
---|
118 | |
---|
119 | $(GEN_SERVER_OBJECTS) $(PRIVATE_SERVER_OBJECTS): $(SERVER_INCLUDES) $(GEN_SERVER_SOURCES) $(PRIVATE_SERVER_OBJECTS:.o=.c) |
---|
120 | $(COMPILER) -c -o $@ $(@:.o=.c) -IGENH -I. -IC -DAISC_SAVE_$(AISC_SAVE) $(POST_COMPILE) $< |
---|
121 | |
---|
122 | O/%.o: C/%.c $(GEN_INCLUDES) $(CLIENT_INCLUDES) C/server.h |
---|
123 | $(COMPILER) -c -o $@ $< -IGENH -I. -IC $(POST_COMPILE) $< |
---|
124 | |
---|
125 | $(CLIENT_OBJECTS): $(CLIENT_OBJECTS:O/%.o=C/%.c) $(GEN_INCLUDES) $(CLIENT_INCLUDES) |
---|
126 | $(CLIENTCOMPILER) -c -o $@ C/$(@F:.o=.c) -IGENH -I. -IC $(POST_COMPILE) $< |
---|
127 | |
---|
128 | $(DUMPDIR): |
---|
129 | mkdir -p $(DUMPDIR) |
---|
130 | |
---|
131 | $(GLOBALS_AISC).tmp: |
---|
132 | @echo "AISC_SAVE $(AISC_SAVE);" > $@ |
---|
133 | |
---|
134 | $(GLOBALS_AISC): $(GLOBALS_AISC).tmp |
---|
135 | $(ARBHOME)/SOURCE_TOOLS/mv_if_diff $(GLOBALS_AISC).tmp $(GLOBALS_AISC) |
---|
136 | |
---|
137 | GENH/%.h: AISC/%.pa $(AISC_DEPENDS) $(INCLUDE_INCLUDES) |
---|
138 | $(RUN_AISC) $< $(MAIN_SOURCE) $@ |
---|
139 | |
---|
140 | GENC/%.c: AISC/%.pa $(AISC_DEPENDS) $(AISC_SERVER_EXTERN) $(GEN_SERVER_INCLUDES) |
---|
141 | $(RUN_AISC) $< $(MAIN_SOURCE) $@ $(AISC_SERVER_EXTERN) $(IMPORT_PROTO) $(GLOBALS_AISC) |
---|
142 | |
---|
143 | $(IMPORT_PROTO): $(GEN_SERVER_PROTO_SOURCES) |
---|
144 | echo $@ |
---|
145 | |
---|
146 | $(AISC_SERVER_EXTERN): $(AISC_EXTERNALS) $(AISC_MKPT) $(THIS) |
---|
147 | rm -f $(AISC_SERVER_EXTERN) |
---|
148 | $(AISC_MKPT) -a $(AISC_EXTERNALS) >$@ |
---|
149 | |
---|
150 | $(GEN_SERVER_EXTERN_PROTO): $(AISC_EXTERNALS) $(AISC_MKPT) $(THIS) |
---|
151 | rm -f $(GEN_SERVER_EXTERN_PROTO) |
---|
152 | $(AISC_MKPT) -w $(subst GENH/,,$@) $(AISC_EXTERNALS) >$@ |
---|
153 | |
---|
154 | $(GEN_SERVER_PROTO): $(GEN_SERVER_PROTO_SOURCES) $(AISC_MKPT) $(THIS) |
---|
155 | rm -f $@ |
---|
156 | $(AISC_MKPT) -w $(subst GENH/,,$@) $(GEN_SERVER_PROTO_SOURCES) >$@ |
---|
157 | |
---|
158 | clean: |
---|
159 | @rm -f *.[ao] */*.[ao] |
---|
160 | @rm -rf GENH GENC DUMP O |
---|
161 | @rm -f .depends |
---|
162 | |
---|
163 | .depends: |
---|
164 | $(MAKEDEPEND) $(MAKEDEPENDFLAGS) C/*.c GENC/*.c -I GENH -I C -f- -w1 2>/dev/null \ |
---|
165 | | grep -v ' /usr' \ |
---|
166 | | $(SED) -e 's/^C/O/ig' \ |
---|
167 | > .depends_new |
---|
168 | $(ARBHOME)/SOURCE_TOOLS/mv_if_diff .depends_new .depends |
---|
169 | |
---|
170 | ifeq ($(AUTODEPENDS),2) |
---|
171 | include .depends |
---|
172 | endif |
---|