2001-01-25 10:37:55 +01:00
|
|
|
## include this File in all Makefiles for Eressea
|
|
|
|
|
|
|
|
ifndef ERESSEA
|
2001-01-30 20:32:44 +01:00
|
|
|
export ERESSEA=$(PWD)
|
2001-01-25 10:37:55 +01:00
|
|
|
endif
|
|
|
|
|
2001-01-30 20:32:44 +01:00
|
|
|
default: debug
|
|
|
|
|
|
|
|
DEPEND = @g++ -MM -MG -r
|
|
|
|
AR = @ar
|
|
|
|
CTAGS = @ctags
|
|
|
|
CC = @gcc
|
|
|
|
LD = @gcc
|
|
|
|
INSTALL = @cp
|
|
|
|
#INSTALL = install
|
2001-01-25 10:37:55 +01:00
|
|
|
|
2001-01-29 20:15:12 +01:00
|
|
|
|
2001-01-30 20:32:44 +01:00
|
|
|
ARFLAGS = cr
|
2001-01-31 18:40:53 +01:00
|
|
|
CTAGSFLAGS = --langmap=c:.c.h --c-types=-m
|
2001-01-30 20:32:44 +01:00
|
|
|
CFLAGS = -I$(ERESSEA) -Wall -Wwrite-strings -Wstrict-prototypes \
|
2001-01-25 10:37:55 +01:00
|
|
|
-Wpointer-arith -Werror-implicit-function-declaration \
|
2001-02-09 16:17:31 +01:00
|
|
|
-Wno-char-subscripts \
|
2001-01-25 10:37:55 +01:00
|
|
|
-march=pentiumpro -fPIC $(INCLUDES)
|
2001-01-30 20:32:44 +01:00
|
|
|
LDFLAGS = $(LIBS)
|
2001-01-25 10:37:55 +01:00
|
|
|
|
|
|
|
LIBS = -L$(PUBLISH_DIR)
|
|
|
|
|
2001-01-30 20:32:44 +01:00
|
|
|
ARCHITECTURE = Linux
|
|
|
|
|
|
|
|
##
|
|
|
|
## user-defined makefiles
|
|
|
|
##
|
|
|
|
|
|
|
|
MKFILES = $(wildcard $(ERESSEA)/$(USER).mk $(ERESSEA)/$(OSTYPE).mk $(ERESSEA)/$(HOSTTYPE).mk $(ERESSEA)/$(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)
|
|
|
|
CFLAGS += -g
|
|
|
|
LDFLAGS += -g
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(CONFIG), release)
|
|
|
|
BUILD_DIR = Release-$(ARCHITECTURE)
|
2001-01-30 17:14:16 +01:00
|
|
|
CFLAGS += -O4 -s -funroll-loops -fomit-frame-pointer
|
|
|
|
LDFLAGS += -s
|
2001-01-25 10:37:55 +01:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(CONFIG), profile)
|
|
|
|
BUILD_DIR = Profile-$(ARCHITECTURE)
|
|
|
|
CFLAGS += -g -pg -O4 -funroll-loops
|
|
|
|
LDFLAGS += -g -pg
|
|
|
|
endif
|
|
|
|
|
2001-02-09 16:17:31 +01:00
|
|
|
ifeq ($(CONFIG), dmalloc)
|
|
|
|
BUILD_DIR = Dmalloc-$(ARCHITECTURE)
|
|
|
|
CFLAGS += -g -DDMALLOC
|
|
|
|
LDFLAGS += -g
|
|
|
|
LIBS += -ldmalloc
|
|
|
|
endif
|
|
|
|
|
2001-01-25 10:37:55 +01:00
|
|
|
|
|
|
|
#
|
|
|
|
## 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
|
|
|
|
|
2001-01-30 17:14:16 +01:00
|
|
|
|
2001-01-29 20:15:12 +01:00
|
|
|
#
|
|
|
|
## Tags
|
|
|
|
#
|
2001-02-04 11:04:36 +01:00
|
|
|
tags: depend
|
2001-01-29 20:15:12 +01:00
|
|
|
@echo "Creating tags in `pwd`/tags";
|
|
|
|
$(CTAGS) $(CTAGSFLAGS) --recurse=yes -f $(ERESSEA)/tags $(ERESSEA)
|
2001-01-25 10:37:55 +01:00
|
|
|
|
|
|
|
|
|
|
|
PUBLISH_DIR = $(ERESSEA)/$(BUILD_DIR)
|
|
|
|
|
|
|
|
env:
|
|
|
|
@$(MAKEENV)
|
|
|
|
|
2001-02-09 16:17:31 +01:00
|
|
|
debug release profile dmalloc:: 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
|
2001-02-09 16:17:31 +01:00
|
|
|
recurse-subdirs-dmalloc:: subdirs-dmalloc publish-dmalloc
|
2001-01-27 19:15:52 +01:00
|
|
|
|
|
|
|
recurse-clean:: clean
|
|
|
|
recurse-depend:: depend
|
|
|
|
|
2001-02-09 16:17:31 +01:00
|
|
|
subdirs-debug subdirs-release subdirs-profile subdirs-dmalloc 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 \
|
|
|
|
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
|
2001-02-09 16:17:31 +01:00
|
|
|
publish-dmalloc:: subdirs-dmalloc
|
2001-01-25 10:37:55 +01:00
|
|
|
|
2001-02-09 16:17:31 +01:00
|
|
|
publish-debug publish-release publish-profile publish-dmalloc:: $(PUBLISH_DIR)/$(LIBRARY) $(PUBLISH_DIR)/$(BINARY)
|
2001-01-25 10:37:55 +01:00
|
|
|
|
|
|
|
clean:: $(BUILD_DIR) $(PUBLISH_DIR)
|
2001-02-09 16:17:31 +01:00
|
|
|
rm -fr Release-$(ARCHITECTURE)/* Debug-$(ARCHITECTURE)/* Profile-$(ARCHITECTURE)/* Dmalloc-$(ARCHITECTURE)/*
|
2001-01-25 10:37:55 +01:00
|
|
|
|
|
|
|
$(BUILD_DIR) $(PUBLISH_DIR):
|
|
|
|
@mkdir $@
|
|
|
|
|
|
|
|
# object files:
|
|
|
|
$(BUILD_DIR)/%:: $(BUILD_DIR)
|
|
|
|
$(BUILD_DIR)/%.o:: %.c
|
2001-02-10 13:50:29 +01:00
|
|
|
@echo "***** Compiling $@ *****"
|
2001-01-30 17:14:16 +01:00
|
|
|
$(CC) $(CFLAGS) -o $@ -c $<
|
2001-02-10 13:50:29 +01:00
|
|
|
@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.
|
|
|
|
##
|
|
|
|
|
2001-01-28 10:24:47 +01:00
|
|
|
ifeq ($(CONVERT_TRIGGERS), 1)
|
|
|
|
CFLAGS += -DCONVERT_TRIGGER
|
|
|
|
INCLUDES += -I. -I$(ERESSEA)/eressea/old
|
|
|
|
endif
|