server/src/Makefile.include
Christian Schlittchen 4ebdb69508 - Attribut at_aggressive für die vinya-NPCs.
- User-Makefiles jetzt mit Hostnamen.
2002-11-27 18:28:51 +00:00

204 lines
4.6 KiB
Text

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