source: branches/profile/AISC_COM/AISC/Makefile

Last change on this file was 12592, checked in by epruesse, 10 years ago

remove more traces of common.a

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.5 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
40COMMON_OBJECTS = 
41COMMON_INCLUDES =
42
43AISC_EXTERNALS = C/aisc_extern.c $(PRIVATE_SERVER_OBJECTS:.o=.c)
44GLOBALS_AISC = GENH/global.aisc
45
46AISC_DEPENDS = AISC/*.pa $(MAIN_SOURCE) $(AISC) $(DUMPDIR) $(GLOBALS_AISC)
47
48IMPORT_PROTO = GENH/import_proto.h
49
50SERVER = server.a
51CLIENT = client.a
52
53AISC_SERVER_EXTERN = GENH/aisc_server_extern.aisc
54
55DUMPDIR=DUMP
56
57LINK_TO_OTHER_ARB=~/ARB.aisc_regression_test_vs# create this as symlink to other ARB checkout to activate regression test 
58FAIL_ON_CHANGE=1# 0=continue on change, 1=fail on change
59
60# ----------------------------------------
61
62COMPARE_WITH_OTHER_ARB:=$(shell $(READLINK) $(LINK_TO_OTHER_ARB))
63ifneq ($(COMPARE_WITH_OTHER_ARB),)
64THIS__COMDIR=$(shell pwd)
65COMDIRNAME=$(subst $(ARBHOME),,$(THIS__COMDIR))
66OTHER_COMDIR=$(subst //,/,$(COMPARE_WITH_OTHER_ARB)/$(COMDIRNAME))
67ifeq ($(FAIL_ON_CHANGE),0)
68REGR_FAILURE=(echo "$(THIS):57: Warning: regression on generated code (ignored)" || true)
69else
70REGR_FAILURE=(  echo "$(THIS):59: Error: regression on generated AISC code"; \
71                rm $(SERVER) $(CLIENT) $(COMMON); \
72                false) 
73endif
74endif
75
76# ----------------------------------------
77
78ifeq ($(AUTODEPENDS),1)
79all:
80        +test -f .depends || $(MAKETHIS) "AUTODEPENDS=0" .depends
81        +$(MAKETHIS) "AUTODEPENDS=2" all
82else
83all: directories
84        +$(MAKETHIS) realall
85
86endif
87
88realall: $(CLIENT) $(SERVER) $(COMMON) Makefile $(THIS)
89ifeq ($(COMPARE_WITH_OTHER_ARB),)
90        @echo "AISC regression tests are disabled ($(LINK_TO_OTHER_ARB) not found from AISC_COM/$(THIS))"
91else
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
104endif
105
106pregenerate: $(GEN_SERVER_SOURCES) $(SERVER_INCLUDES) $(CLIENT_INCLUDES) $(AISC_EXTERNALS)
107
108directories:
109        @mkdir -p GENH GENC O DUMP
110
111GENH:   directories
112GENC:   directories
113O:      directories
114DUMP:   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
128O/%.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
143GENH/%.h: AISC/%.pa $(AISC_DEPENDS) $(INCLUDE_INCLUDES) 
144        $(RUN_AISC) $< $(MAIN_SOURCE) $@
145
146GENC/%.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
164clean:
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
176ifeq ($(AUTODEPENDS),2)
177include .depends
178endif
Note: See TracBrowser for help on using the repository browser.