## include this File in all Makefiles for Eressea default: debug ifndef ERESSEA MAKEENV = echo "Missing ERESSEA environment variable." && exit 1 endif DEPEND = g++ -MM -MG -r AR = ar ARFLAGS = cr CC = gcc CFLAGS = -I$(ERESSEA) -Wall -Wwrite-strings -Wstrict-prototypes \ -Wpointer-arith -Werror-implicit-function-declaration \ -Wno-char-subscripts \ -march=pentiumpro -fPIC $(INCLUDES) LIBS = -L$(PUBLISH_DIR) LD = gcc LDFLAGS = $(LIBS) #INSTALL = install INSTALL = cp ARCHITECTURE=Linux ## ## Architecture-Dependent Exe and Library Names ## ifeq ($(ARCHITECTURE), Linux) ifneq ($(LIBNAME), ) LIBRARY = lib$(LIBNAME).a endif ifneq ($(EXENAME), ) BINARY = $(EXENAME) endif endif ifeq ($(ARCHITECTURE), Windows) ifneq ($(LIBNAME), ) LIBRARY = $(LIBNAME).lib endif ifneq ($(EXENAME), ) BINARY = $(EXENAME).exe endif endif ifeq ($(CONFIG), debug) BUILD_DIR = Debug-$(ARCHITECTURE) CFLAGS += -g LDFLAGS += -g endif ifeq ($(CONFIG), release) BUILD_DIR = Release-$(ARCHITECTURE) CFLAGS += -O4 -funroll-loops -fomit-frame-pointer endif ifeq ($(CONFIG), profile) BUILD_DIR = Profile-$(ARCHITECTURE) CFLAGS += -g -pg -O4 -funroll-loops LDFLAGS += -g -pg endif # ## Dependencies # ifneq ($(wildcard *.c),) ifeq (.depend,$(wildcard .depend)) include .depend endif # Create dependencies depend:: @echo "Creating dependencies in `pwd`/.depend"; $(DEPEND) $(CFLAGS) $(DEFINES) $(INCDIRS) $(SOURCES) >| .depend endif PUBLISH_DIR = $(ERESSEA)/$(BUILD_DIR) env: @$(MAKEENV) debug release profile:: env $(PUBLISH_DIR) $(PUBLISH_DIR) $(MAKE) CONFIG=$@ recurse-subdirs-$@ ## ## recurse-subdirs-X is called from a Makefile one level up. ## recurse-subdirs-debug:: subdirs-debug publish-debug recurse-subdirs-release:: subdirs-release publish-release recurse-subdirs-profile:: subdirs-profile publish-profile recurse-clean:: clean recurse-depend:: depend subdirs-debug subdirs-release subdirs-profile clean depend:: @mkdir -p $(PUBLISH_DIR) @if [ -n "$(SUBDIRS)" ]; then \ for subdir in x-placeholder-dir $(SUBDIRS); do \ if [ -d $$subdir ]; then \ echo --\> Making $@ in $$subdir ; \ mkdir -p $$subdir/$(BUILD_DIR) ; \ $(MAKE) -C $$subdir -$(MAKEFLAGS) recurse-$@ || exit 1; \ fi \ done \ fi publish-debug:: subdirs-debug publish-release:: subdirs-release publish-profile:: subdirs-profile publish-debug publish-release publish-profile:: $(BUILD_DIR)/$(LIBRARY) $(BUILD_DIR)/$(BINARY) clean:: $(BUILD_DIR) $(PUBLISH_DIR) rm -fr Release-$(ARCHITECTURE)/* Debug-$(ARCHITECTURE)/* Profile-$(ARCHITECTURE)/* $(BUILD_DIR) $(PUBLISH_DIR): @mkdir $@ # object files: $(BUILD_DIR)/%:: $(BUILD_DIR) $(BUILD_DIR)/%.o:: %.c @echo "Compiling $@" @$(CC) -o $@ -c $< $(CFLAGS) ## ## conversion code for old triggers - should only be used for free eressea, ## and only for old datafiles. ## #CFLAGS += -DCONVERT_TRIGGER #INCLUDES += -I. -I$(ERESSEA)/eressea/old