| 1 | |
|---|
| 2 | # no-strict-aliasing is important - starting with gcc 4.1.1 code doesn't work without! |
|---|
| 3 | # (problems are caused by type-punning w/o using union which is used widely here) |
|---|
| 4 | FORCED_FLAGS=-fno-strict-aliasing -Wno-unused |
|---|
| 5 | |
|---|
| 6 | .SUFFIXES: .o .c .h .aisc |
|---|
| 7 | |
|---|
| 8 | #where to find the creator files |
|---|
| 9 | AISC = ../MAKEBIN/aisc |
|---|
| 10 | AISC_MKPT = ../MAKEBIN/aisc_mkpt |
|---|
| 11 | |
|---|
| 12 | GEN_INCLUDES = GENH/aisc.h GENH/aisc_com.h |
|---|
| 13 | INCLUDE_INCLUDES = aisc_include.header |
|---|
| 14 | |
|---|
| 15 | GEN_SERVER_PROTO = GENH/aisc_server_proto.h |
|---|
| 16 | S_GEN_SERVER_PROTO = GENC/aisc_server.c |
|---|
| 17 | |
|---|
| 18 | SERVER_OBJECTS = O/server.o O/struct_man.o O/aisc_extern.o |
|---|
| 19 | GEN_SERVER_OBJECTS = GENC/aisc_global.o GENC/aisc_server.o |
|---|
| 20 | GEN_SERVER_INCLUDES = C/aisc_server.h |
|---|
| 21 | GEN_SERVER_EXTERN_PROTO = GENH/aisc_server_extern.h |
|---|
| 22 | |
|---|
| 23 | CLIENT_OBJECTS = O/client.o O/debug.o |
|---|
| 24 | GEN_CLIENT_OBJECTS = GENC/aisc_debug_globals.o |
|---|
| 25 | CLIENT_INCLUDES = C/client_privat.h C/client.h |
|---|
| 26 | |
|---|
| 27 | AISC_EXTERNALS = C/aisc_extern.c $(PRIVATE_SERVER_OBJECTS:.o=.c) |
|---|
| 28 | |
|---|
| 29 | IMPORT_PROTO = GENH/import_proto.h |
|---|
| 30 | |
|---|
| 31 | SERVER = server.a |
|---|
| 32 | CLIENT = client.a |
|---|
| 33 | |
|---|
| 34 | AISC_SERVER_EXTERN = GENH/aisc_server_extern.aisc |
|---|
| 35 | |
|---|
| 36 | all: $(CLIENT) $(SERVER) |
|---|
| 37 | |
|---|
| 38 | pregenerate: $(GEN_INCLUDES) $(GEN_SERVER_PROTO) $(GEN_SERVER_OBJECTS:.o=.c) |
|---|
| 39 | |
|---|
| 40 | $(SERVER): $(SERVER_OBJECTS) $(GEN_SERVER_OBJECTS) $(PRIVATE_SERVER_OBJECTS) |
|---|
| 41 | $(LINK_STATIC_LIB) $@ $^ |
|---|
| 42 | |
|---|
| 43 | $(CLIENT): $(CLIENT_OBJECTS) $(GEN_CLIENT_OBJECTS) |
|---|
| 44 | $(LINK_STATIC_LIB) $@ $^ |
|---|
| 45 | |
|---|
| 46 | $(GEN_SERVER_OBJECTS) $(PRIVATE_SERVER_OBJECTS): \ |
|---|
| 47 | $(GEN_INCLUDES) $(GEN_SERVER_PROTO) \ |
|---|
| 48 | $(GEN_SERVER_EXTERN_PROTO) $(IMPORT_PROTO) \ |
|---|
| 49 | $(GEN_SERVER_OBJECTS:.o=.c) \ |
|---|
| 50 | $(PRIVATE_SERVER_OBJECTS:.o=.c) |
|---|
| 51 | $(COMPILER) $(FORCED_FLAGS) -c -o $@ $(@:.o=.c) -IGENH -I. -IC -DAISC_SAVE_$(AISC_SAVE) |
|---|
| 52 | |
|---|
| 53 | $(GEN_CLIENT_OBJECTS): $(GEN_INCLUDES) $(GEN_CLIENT_OBJECTS:.o=.c) |
|---|
| 54 | $(CLIENTCOMPILER) $(FORCED_FLAGS) -c -o $@ $(@:.o=.c) -IGENH -I. -IC |
|---|
| 55 | |
|---|
| 56 | O/%.o: C/%.c $(GEN_INCLUDES) $(CLIENT_INCLUDES) C/server.h |
|---|
| 57 | $(COMPILER) $(FORCED_FLAGS) -c -o $@ $< -IGENH -I. -IC |
|---|
| 58 | |
|---|
| 59 | $(CLIENT_OBJECTS): $(CLIENT_OBJECTS:O/%.o=C/%.c) $(GEN_INCLUDES) $(CLIENT_INCLUDES) |
|---|
| 60 | $(CLIENTCOMPILER) $(FORCED_FLAGS) -c -o $@ C/$(@F:.o=.c) -IGENH -I. -IC |
|---|
| 61 | |
|---|
| 62 | GENH/%.h: AISC/%.pa AISC/*.pa $(MAIN_SOURCE) $(INCLUDE_INCLUDES) $(AISC) |
|---|
| 63 | $(AISC) $< $(MAIN_SOURCE) $@ |
|---|
| 64 | |
|---|
| 65 | GENC/%.c: AISC/%.pa AISC/*.pa $(MAIN_SOURCE) $(AISC_SERVER_EXTERN) $(AISC) |
|---|
| 66 | $(AISC) $< $(MAIN_SOURCE) $@ $(AISC_SERVER_EXTERN) $(IMPORT_PROTO) |
|---|
| 67 | |
|---|
| 68 | $(IMPORT_PROTO): GENC/aisc_server.c |
|---|
| 69 | echo $@ |
|---|
| 70 | |
|---|
| 71 | $(AISC_SERVER_EXTERN): $(AISC_EXTERNALS) |
|---|
| 72 | rm -f $(AISC_SERVER_EXTERN) |
|---|
| 73 | $(AISC_MKPT) -a $(AISC_EXTERNALS) >$@ |
|---|
| 74 | |
|---|
| 75 | $(GEN_SERVER_EXTERN_PROTO): $(AISC_EXTERNALS) |
|---|
| 76 | rm -f $(GEN_SERVER_EXTERN_PROTO) |
|---|
| 77 | $(AISC_MKPT) -C $(AISC_EXTERNALS) >$@ |
|---|
| 78 | |
|---|
| 79 | $(GEN_SERVER_PROTO): $(S_GEN_SERVER_PROTO) |
|---|
| 80 | rm -f $@ |
|---|
| 81 | $(AISC_MKPT) -C $(S_GEN_SERVER_PROTO) >$@ |
|---|
| 82 | |
|---|
| 83 | clean: |
|---|
| 84 | rm -f *.[ao] |
|---|
| 85 | rm -f */*.[ao] |
|---|
| 86 | rm -f GENH/* |
|---|
| 87 | rm -f GENC/* |
|---|
| 88 | rm -f .depends |
|---|
| 89 | |
|---|
| 90 | .depends: |
|---|
| 91 | $(MAKEDEPEND) C/*.c GENC/*.c -I GENH -I C -f- -w1 | grep -v ' /usr' | sed -e 's/^C/O/ig' > .depends_new |
|---|
| 92 | $(ARBHOME)/SOURCE_TOOLS/mv_if_diff .depends_new .depends |
|---|
| 93 | |
|---|
| 94 | ifeq ($(AUTODEPENDS),1) |
|---|
| 95 | include .depends |
|---|
| 96 | endif |
|---|