From 66bbf336c6af7353ef0aeed58002c46543b30635 Mon Sep 17 00:00:00 2001 From: rubidium Date: Tue, 2 Jan 2007 19:19:48 +0000 Subject: (svn r7759) -Merge: makefile rewrite. This merge features: - A proper ./configure, so everything needs to be configured only once, not for every make. - Usage of makedepend when available. This greatly reduces the time needed for generating the dependencies. - A generator for all project files. There is a single file with sources, which is used to generate Makefiles and the project files for MSVC. - Proper support for OSX universal binaries. - Object files for non-MSVC compiles are also placed in separate directories, making is faster to switch between debug and release compiles and it does not touch the directory with the source files. - Functionality to make a bundle of all needed files for for example a nightly or distribution of a binary with all needed GRFs and language files. Note: as this merge moves almost all files, it is recommended to make a backup of your working copy before updating your working copy. --- Makefile.lang.in | 85 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 Makefile.lang.in (limited to 'Makefile.lang.in') diff --git a/Makefile.lang.in b/Makefile.lang.in new file mode 100644 index 000000000..a12e69601 --- /dev/null +++ b/Makefile.lang.in @@ -0,0 +1,85 @@ +# Auto-generated file -- DO NOT EDIT + +STRGEN = !!STRGEN!! +ENDIAN_CHECK = !!ENDIAN_CHECK!! +SRC_DIR = !!SRC_DIR!! +LANG_DIR = !!LANG_DIR!! +BIN_DIR = !!BIN_DIR!! +LANGS_SRC = $(shell ls $(LANG_DIR)/*.txt) +LANGS = $(LANGS_SRC:$(LANG_DIR)/%.txt=%.lng) +CC_BUILD = !!CC_BUILD!! +CFLAGS_BUILD = !!CFLAGS_BUILD!! +STRGEN_FLAGS = !!STRGEN_FLAGS!! +STAGE = !!STAGE!! +LANG_SUPPRESS= !!LANG_SUPPRESS!! +LANG_OBJS_DIR= !!LANG_OBJS_DIR!! + +ifeq ($(LANG_SUPPRESS), yes) +LANG_ERRORS = >/dev/null 2>&1 +endif + +# Make sure endian_host.h is reasable as if it was in the src/ dir +CFLAGS_BUILD += -I $(LANG_OBJS_DIR) + +ENDIAN_TARGETS := endian_host.h endian_target.h $(ENDIAN_CHECK) + +# Check if we want to show what we are doing +ifdef VERBOSE + Q = + E = @true +else + Q = @ + E = @echo +endif + +RES := $(shell mkdir -p $(BIN_DIR)/lang ) + +all: table/strings.h $(LANGS) + +strgen.o: $(SRC_DIR)/strgen/strgen.c endian_host.h + $(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.c=%.c)' + $(Q)$(CC_BUILD) $(CFLAGS_BUILD) -DSTRGEN -c -o $@ $< + +string.o: $(SRC_DIR)/string.c endian_host.h + $(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.c=%.c)' + $(Q)$(CC_BUILD) $(CFLAGS_BUILD) -DSTRGEN -c -o $@ $< + +lang/english.txt: $(LANG_DIR)/english.txt + $(Q)mkdir -p lang + $(Q)cp $(LANG_DIR)/english.txt lang/english.txt + +$(STRGEN): string.o strgen.o + $(E) '$(STAGE) Compiling and Linking $@' + $(Q)$(CC_BUILD) string.o strgen.o -o $@ + +table/strings.h: lang/english.txt $(STRGEN) + $(E) '$(STAGE) Generating $@' + @mkdir -p table + $(Q)./$(STRGEN) -s $(LANG_DIR) -d table + +$(LANGS): %.lng: $(LANG_DIR)/%.txt $(STRGEN) lang/english.txt + $(E) '$(STAGE) Compiling language $(*F)' + $(Q)./$(STRGEN) $(STRGEN_FLAGS) -s $(LANG_DIR) -d $(LANG_OBJS_DIR) $< $(LANG_ERRORS) && cp $@ $(BIN_DIR)/lang + +# The targets to compile the endian-code + +endian_host.h: $(ENDIAN_CHECK) + $(E) '$(STAGE) Testing endianness for host' + $(Q)./$(ENDIAN_CHECK) > $@ + +$(ENDIAN_CHECK): $(SRC_DIR)/endian_check.c + $(E) '$(STAGE) Compiling and Linking $@' + $(Q)$(CC_BUILD) $(CFLAGS_BUILD) $< -o $@ + +depend: + +clean: + $(E) '$(STAGE) Cleaning up language files' + $(Q)rm -f strgen.o table/strings.h $(STRGEN) $(LANGS) $(LANGS:%=$(BIN_DIR)/lang/%) lang/english.* $(ENDIAN_TARGETS) + +mrproper: clean + +%.lng: + @echo '$(STAGE) No such language: $(@:%.lng=%)' + +.PHONY: all mrproper depend clean -- cgit v1.2.3-70-g09d2