server/src/Makefile.include

205 lines
4.6 KiB
Makefile
Raw Normal View History

2001-01-25 10:37:55 +01:00
## include this File in all Makefiles for Eressea
2002-09-12 22:45:34 +02:00
ifndef ERESSEA_SRC
export ERESSEA_SRC=$(PWD)
2001-01-25 10:37:55 +01:00
endif
2002-03-31 13:05:13 +02:00
.PHONY: tags
default: debug
2001-03-23 11:07:00 +01:00
DEPEND = @gcc -MM -MG -r
AR = @ar
2002-03-31 13:05:13 +02:00
CTAGS = ctags-exuberant
CC = @gcc
LD = @gcc
INSTALL = @cp
#INSTALL = install
2001-01-25 10:37:55 +01:00
2001-02-11 20:55:00 +01:00
ARFLAGS = crs
2002-02-10 18:56:03 +01:00
CTAGSFLAGS = --c-types=cdefgmnstuv
2002-09-12 22:45:34 +02:00
CFLAGS = -I$(ERESSEA_SRC) -Wall -Wwrite-strings -Wstrict-prototypes \
-Werror-implicit-function-declaration \
-Wno-char-subscripts $(INCLUDES)
LDFLAGS = $(LIBS)
2001-01-25 10:37:55 +01:00
LIBS = -L$(PUBLISH_DIR)
LINTFLAGS = -booltype boolean -boolops +posixlib +matchanyintegral \
-predboolint -retvalint -retvalother -realcompare -exportlocal \
-DHAVE_READDIR
ARCHITECTURE = Linux
##
2001-02-10 23:02:10 +01:00
## Default-Strings. K<>nnen in $(USER).mk <20>berschrieben werden
##
2001-02-10 23:02:10 +01:00
MSG_COMPILE = "---> Compiling $@"
MSG_SUBDIR = "--> Making $@ in $$subdir"
##
## user-defined makefiles
##
MKFILES = $(wildcard $(ERESSEA_SRC)/$(USER)@$(HOST).mk $(ERESSEA_SRC)/$(OSTYPE).mk $(ERESSEA_SRC)/$(HOSTTYPE).mk $(ERESSEA_SRC)/$(ARCH).mk)
ifeq ($(MKFILES), )
else
include $(MKFILES)
endif
2001-01-25 10:37:55 +01:00
2001-01-27 19:15:52 +01:00
##
## 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
2001-01-25 10:37:55 +01:00
ifeq ($(CONFIG), debug)
BUILD_DIR = Debug-$(ARCHITECTURE)
2001-02-11 20:55:00 +01:00
CFLAGS += -ggdb
LDFLAGS += -ggdb
2001-01-25 10:37:55 +01:00
endif
ifeq ($(CONFIG), release)
BUILD_DIR = Release-$(ARCHITECTURE)
CFLAGS += -O4 -DNDEBUG -funroll-loops -fomit-frame-pointer -ggdb
LDFLAGS += -ggdb
2001-01-25 10:37:55 +01:00
endif
ifeq ($(CONFIG), profile)
BUILD_DIR = Profile-$(ARCHITECTURE)
2001-02-11 20:55:00 +01:00
CFLAGS += -ggdb -pg -O4 -funroll-loops
LDFLAGS += -ggdb -pg
2001-01-25 10:37:55 +01:00
endif
ifeq ($(CONFIG), dmalloc)
BUILD_DIR = Dmalloc-$(ARCHITECTURE)
2001-02-11 20:55:00 +01:00
CFLAGS += -ggdb -DDMALLOC
LDFLAGS += -ggdb
LIBS += -ldmalloc
endif
2002-03-31 15:34:02 +02:00
ifeq ($(CONFIG), ccmalloc)
BUILD_DIR = Ccmalloc-$(ARCHITECTURE)
CFLAGS += -ggdb
LDFLAGS += -ggdb
LD = ccmalloc gcc
endif
# ifeq ($(CONFIG), lint)
# BUILD_DIR = Lint-$(ARCHITECTURE)
# CC = lint
2002-09-12 22:45:34 +02:00
# CFLAGS = -I$(ERESSEA_SRC) $(INCLUDES) -booltype boolean -boolops
# LDFLAGS =
# LIBS =
# endif
2001-01-25 10:37:55 +01:00
#
## Dependencies
#
ifneq ($(wildcard *.c),)
ifeq (.depend,$(wildcard .depend))
include .depend
endif
# Create dependencies
depend:: $(SOURCES)
2001-01-25 10:37:55 +01:00
@echo "Creating dependencies in `pwd`/.depend";
2002-04-21 12:45:24 +02:00
@$(DEPEND) $(CFLAGS) $(DEFINES) $(INCDIRS) $(SOURCES) >| .depend
@perl -pe 's/(.*\.o)/Debug-$(ARCHITECTURE)\/\1 Release-$(ARCHITECTURE)\/\1/' -i .depend
2001-01-25 10:37:55 +01:00
endif
#
## Tags
#
2002-02-10 18:56:03 +01:00
tags:
@echo "Creating tags in `pwd`/tags";
2002-09-12 22:45:34 +02:00
$(CTAGS) $(CTAGSFLAGS) --recurse=yes -f $(ERESSEA_SRC)/tags $(ERESSEA_SRC)
2001-01-25 10:37:55 +01:00
2002-09-12 22:45:34 +02:00
PUBLISH_DIR = $(ERESSEA_SRC)/$(BUILD_DIR)
2001-01-25 10:37:55 +01:00
env:
@$(MAKEENV)
2002-03-31 15:34:02 +02:00
debug release profile dmalloc ccmalloc:: env $(PUBLISH_DIR) $(PUBLISH_DIR)
2001-01-27 19:15:52 +01:00
$(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-subdirs-dmalloc:: subdirs-dmalloc publish-dmalloc
2002-03-31 15:34:02 +02:00
recurse-subdirs-ccmalloc:: subdirs-ccmalloc publish-ccmalloc
2001-01-27 19:15:52 +01:00
recurse-lint:: lint
2001-01-27 19:15:52 +01:00
recurse-clean:: clean
recurse-depend:: depend
2002-03-31 15:34:02 +02:00
subdirs-debug subdirs-release subdirs-profile subdirs-dmalloc subdirs-ccmalloc lint clean depend::
2001-01-27 19:15:52 +01:00
@mkdir -p $(PUBLISH_DIR)
@if [ -n "$(SUBDIRS)" ]; then \
for subdir in x-placeholder-dir $(SUBDIRS); do \
if [ -d $$subdir ]; then \
2001-02-10 23:02:10 +01:00
echo $(MSG_SUBDIR); \
2001-01-27 19:15:52 +01:00
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-dmalloc:: subdirs-dmalloc
2002-03-31 15:34:02 +02:00
publish-ccmalloc:: subdirs-ccmalloc
2001-01-25 10:37:55 +01:00
2002-03-31 15:34:02 +02:00
publish-debug publish-release publish-profile publish-ccmalloc:: $(PUBLISH_DIR)/$(LIBRARY) $(PUBLISH_DIR)/$(BINARY)
2001-01-25 10:37:55 +01:00
clean:: $(BUILD_DIR) $(PUBLISH_DIR)
2002-03-31 15:34:02 +02:00
rm -fr Release-$(ARCHITECTURE)/* Debug-$(ARCHITECTURE)/* Profile-$(ARCHITECTURE)/* Dmalloc-$(ARCHITECTURE)/* Ccmalloc-$(ARCHITECTURE) Lint-$(ARCHITECTURE)/*
lint::
2002-09-12 22:45:34 +02:00
$(LINT) -I$(ERESSEA_SRC) $(INCLUDES) $(LINTFLAGS) *.c
2001-01-25 10:37:55 +01:00
$(BUILD_DIR) $(PUBLISH_DIR):
2002-10-06 09:42:42 +02:00
@mkdir -p $@
2001-01-25 10:37:55 +01:00
# object files:
$(BUILD_DIR)/%:: $(BUILD_DIR)
$(BUILD_DIR)/%.o:: %.c
@echo $(MSG_COMPILE)
$(CC) $(CFLAGS) -o $@ -c $<
@echo
2001-01-27 19:15:52 +01:00
##
## conversion code for old triggers - should only be used for free eressea,
## and only for old datafiles.
##
ifeq ($(CONVERT_TRIGGERS), 1)
CFLAGS += -DCONVERT_TRIGGER
2002-09-12 22:45:34 +02:00
INCLUDES += -I. -I$(ERESSEA_SRC)/eressea/old
endif