source: branches/stable/AISC_COM/AISC/Makefile

Last change on this file was 17618, checked in by westram, 6 years ago
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.3 KB
Line 
1THIS=AISC/Makefile
2MAKETHIS=$(MAKE) -f $(THIS)
3#MAKETHIS=$(MAKE) -d -f $(THIS)
4SED:=$(ARBHOME)/SH/arb_sed
5READLINK:=$(ARBHOME)/SH/arb_readlink
6
7.SUFFIXES: .o .c .h .aisc
8
9#where to find the creator files
10AISC=../AISC/aisc
11AISC_MKPT = ../AISC_MKPTPS/aisc_mkpt
12
13RUN_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
19GEN_INCLUDES = GENH/aisc.h GENH/aisc_com.h
20INCLUDE_INCLUDES = aisc_include.header
21
22SERVER_OBJECTS = O/server.o O/struct_man.o O/aisc_extern.o
23
24GEN_SERVER_PROTO_OBJECTS = GENC/aisc_server.o
25GEN_SERVER_OTHER_OBJECTS = GENC/aisc_global.o
26GEN_SERVER_OBJECTS = $(GEN_SERVER_PROTO_OBJECTS) $(GEN_SERVER_OTHER_OBJECTS)
27
28GEN_SERVER_PROTO_SOURCES = $(GEN_SERVER_PROTO_OBJECTS:.o=.c)
29GEN_SERVER_SOURCES = $(GEN_SERVER_OBJECTS:.o=.c)
30
31GEN_SERVER_INCLUDES = C/aisc_server.h
32GEN_SERVER_PROTO = GENH/aisc_server_proto.h
33GEN_SERVER_EXTERN_PROTO = GENH/aisc_server_extern.h
34
35SERVER_INCLUDES = $(GEN_INCLUDES) $(GEN_SERVER_INCLUDES) $(GEN_SERVER_PROTO) $(GEN_SERVER_EXTERN_PROTO)
36
37CLIENT_OBJECTS = O/client.o
38CLIENT_INCLUDES = $(GEN_INCLUDES) C/client_privat.h C/client.h
39
40AISC_EXTERNALS = C/aisc_extern.c $(PRIVATE_SERVER_OBJECTS:.o=.c)
41GLOBALS_AISC = GENH/global.aisc
42
43AISC_DEPENDS = AISC/*.pa $(MAIN_SOURCE) $(AISC) $(DUMPDIR) $(GLOBALS_AISC)
44
45IMPORT_PROTO = GENH/import_proto.h
46
47SERVER = server.a
48CLIENT = client.a
49
50AISC_SERVER_EXTERN = GENH/aisc_server_extern.aisc
51
52DUMPDIR=DUMP
53
54LINK_TO_OTHER_ARB=~/ARB.aisc_regression_test_vs# create this as symlink to other ARB checkout to activate regression test 
55FAIL_ON_CHANGE=1# 0=continue on change, 1=fail on change
56
57# ----------------------------------------
58
59COMPARE_WITH_OTHER_ARB:=$(shell $(READLINK) $(LINK_TO_OTHER_ARB))
60ifneq ($(COMPARE_WITH_OTHER_ARB),)
61THIS__COMDIR=$(shell pwd)
62COMDIRNAME=$(subst $(ARBHOME),,$(THIS__COMDIR))
63OTHER_COMDIR=$(subst //,/,$(COMPARE_WITH_OTHER_ARB)/$(COMDIRNAME))
64ifeq ($(FAIL_ON_CHANGE),0)
65REGR_FAILURE=(echo "$(THIS):57: Warning: regression on generated code (ignored)" || true)
66else
67REGR_FAILURE=(  echo "$(THIS):59: Error: regression on generated AISC code"; \
68                rm $(SERVER) $(CLIENT) ; \
69                false) 
70endif
71endif
72
73# ----------------------------------------
74
75ifeq ($(AUTODEPENDS),1)
76all:
77        +test -f .depends || $(MAKETHIS) "AUTODEPENDS=0" .depends
78        +$(MAKETHIS) "AUTODEPENDS=2" all
79else
80all: directories
81        +$(MAKETHIS) realall
82
83endif
84
85realall: $(CLIENT) $(SERVER) Makefile $(THIS)
86ifeq ($(COMPARE_WITH_OTHER_ARB),)
87        @echo "AISC regression tests are disabled ($(LINK_TO_OTHER_ARB) not found from AISC_COM/$(THIS))"
88else
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
101endif
102
103pregenerate: $(GEN_SERVER_SOURCES) $(SERVER_INCLUDES) $(CLIENT_INCLUDES) $(AISC_EXTERNALS)
104
105directories:
106        @mkdir -p GENH GENC O DUMP
107
108GENH:   directories
109GENC:   directories
110O:      directories
111DUMP:   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
122O/%.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
137GENH/%.h: AISC/%.pa $(AISC_DEPENDS) $(INCLUDE_INCLUDES) 
138        $(RUN_AISC) $< $(MAIN_SOURCE) $@
139
140GENC/%.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
158clean:
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
170ifeq ($(AUTODEPENDS),2)
171include .depends
172endif
Note: See TracBrowser for help on using the repository browser.