|
1 # Auto-generated file -- DO NOT EDIT |
|
2 |
|
3 STRGEN = !!STRGEN!! |
|
4 ENDIAN_CHECK = !!ENDIAN_CHECK!! |
|
5 SRC_DIR = !!SRC_DIR!! |
|
6 LANG_DIR = !!LANG_DIR!! |
|
7 BIN_DIR = !!BIN_DIR!! |
|
8 LANGS_SRC = $(shell ls $(LANG_DIR)/*.txt) |
|
9 LANGS = $(LANGS_SRC:$(LANG_DIR)/%.txt=%.lng) |
|
10 CC_BUILD = !!CC_BUILD!! |
|
11 CFLAGS_BUILD = !!CFLAGS_BUILD!! |
|
12 STRGEN_FLAGS = !!STRGEN_FLAGS!! |
|
13 STAGE = !!STAGE!! |
|
14 LANG_SUPPRESS= !!LANG_SUPPRESS!! |
|
15 LANG_OBJS_DIR= !!LANG_OBJS_DIR!! |
|
16 |
|
17 ifeq ($(LANG_SUPPRESS), yes) |
|
18 LANG_ERRORS = >/dev/null 2>&1 |
|
19 endif |
|
20 |
|
21 # Make sure endian_host.h is reasable as if it was in the src/ dir |
|
22 CFLAGS_BUILD += -I $(LANG_OBJS_DIR) |
|
23 |
|
24 ENDIAN_TARGETS := endian_host.h endian_target.h $(ENDIAN_CHECK) |
|
25 |
|
26 # Check if we want to show what we are doing |
|
27 ifdef VERBOSE |
|
28 Q = |
|
29 E = @true |
|
30 else |
|
31 Q = @ |
|
32 E = @echo |
|
33 endif |
|
34 |
|
35 RES := $(shell mkdir -p $(BIN_DIR)/lang ) |
|
36 |
|
37 all: table/strings.h $(LANGS) |
|
38 |
|
39 strgen.o: $(SRC_DIR)/strgen/strgen.c endian_host.h |
|
40 $(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.c=%.c)' |
|
41 $(Q)$(CC_BUILD) $(CFLAGS_BUILD) -DSTRGEN -c -o $@ $< |
|
42 |
|
43 string.o: $(SRC_DIR)/string.c endian_host.h |
|
44 $(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.c=%.c)' |
|
45 $(Q)$(CC_BUILD) $(CFLAGS_BUILD) -DSTRGEN -c -o $@ $< |
|
46 |
|
47 lang/english.txt: $(LANG_DIR)/english.txt |
|
48 $(Q)mkdir -p lang |
|
49 $(Q)cp $(LANG_DIR)/english.txt lang/english.txt |
|
50 |
|
51 $(STRGEN): string.o strgen.o |
|
52 $(E) '$(STAGE) Compiling and Linking $@' |
|
53 $(Q)$(CC_BUILD) string.o strgen.o -o $@ |
|
54 |
|
55 table/strings.h: lang/english.txt $(STRGEN) |
|
56 $(E) '$(STAGE) Generating $@' |
|
57 @mkdir -p table |
|
58 $(Q)./$(STRGEN) -s $(LANG_DIR) -d table |
|
59 |
|
60 $(LANGS): %.lng: $(LANG_DIR)/%.txt $(STRGEN) lang/english.txt |
|
61 $(E) '$(STAGE) Compiling language $(*F)' |
|
62 $(Q)./$(STRGEN) $(STRGEN_FLAGS) -s $(LANG_DIR) -d $(LANG_OBJS_DIR) $< $(LANG_ERRORS) && cp $@ $(BIN_DIR)/lang |
|
63 |
|
64 # The targets to compile the endian-code |
|
65 |
|
66 endian_host.h: $(ENDIAN_CHECK) |
|
67 $(E) '$(STAGE) Testing endianness for host' |
|
68 $(Q)./$(ENDIAN_CHECK) > $@ |
|
69 |
|
70 $(ENDIAN_CHECK): $(SRC_DIR)/endian_check.c |
|
71 $(E) '$(STAGE) Compiling and Linking $@' |
|
72 $(Q)$(CC_BUILD) $(CFLAGS_BUILD) $< -o $@ |
|
73 |
|
74 depend: |
|
75 |
|
76 clean: |
|
77 $(E) '$(STAGE) Cleaning up language files' |
|
78 $(Q)rm -f strgen.o table/strings.h $(STRGEN) $(LANGS) $(LANGS:%=$(BIN_DIR)/lang/%) lang/english.* $(ENDIAN_TARGETS) |
|
79 |
|
80 mrproper: clean |
|
81 |
|
82 %.lng: |
|
83 @echo '$(STAGE) No such language: $(@:%.lng=%)' |
|
84 |
|
85 .PHONY: all mrproper depend clean |