Gobligine/Makefile

359 lines
10 KiB
Makefile
Raw Normal View History

2003-07-03 10:48:48 -06:00
## _________ __ __
## / _____// |_____________ _/ |______ ____ __ __ ______
## \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/
## / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ \
## /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ >
## \/ \/ \//_____/ \/
2000-03-25 15:38:54 -07:00
## ______________________ ______________________
## T H E W A R B E G I N S
2003-07-03 09:35:45 -06:00
## Stratagus - A free fantasy real time strategy game engine
2000-03-25 15:38:54 -07:00
##
## Makefile - The make file.
##
2003-03-13 10:40:12 -07:00
## (c) Copyright 1998-2003 by Lutz Sammer and Nehal Mistry
2000-03-25 15:38:54 -07:00
##
2003-07-03 09:35:45 -06:00
## Stratagus is free software; you can redistribute it and/or modify
2001-05-30 08:47:11 -06:00
## it under the terms of the GNU General Public License as published
2002-03-01 18:30:59 -07:00
## by the Free Software Foundation; only version 2 of the License.
2001-05-30 08:47:11 -06:00
##
2003-07-03 09:35:45 -06:00
## Stratagus is distributed in the hope that it will be useful,
2001-05-30 08:47:11 -06:00
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
2000-03-25 15:38:54 -07:00
## $Id$
##
TOPDIR= .
2000-03-25 15:38:54 -07:00
RULESFILE ?= Rules.make
WINRULESFILE = Rules.make.WIN32
2004-02-16 18:53:55 -07:00
-include $(TOPDIR)/$(RULESFILE)
2002-04-17 13:31:32 -06:00
OBJDIR ?= .
2000-03-25 15:38:54 -07:00
CROSSDIR = /usr/local/cross
2004-02-17 09:21:44 -07:00
INCLUDE_DIRS = src/include src/movie/vp31/include
2002-12-17 18:08:27 -07:00
2004-04-25 21:12:00 -06:00
MODULES = src/action src/ai src/beos src/stratagus src/editor src/game src/map \
2004-01-01 14:24:22 -07:00
src/missile src/movie src/movie/vp31 src/network src/pathfinder src/sound src/ui src/unit \
2004-05-15 05:26:14 -06:00
src/video
2004-04-23 18:27:26 -06:00
MODULES_ALL = $(MODULES)
MISC :=
2002-12-17 18:08:27 -07:00
HDRS :=
include $(patsubst %, %/Module.make, $(INCLUDE_DIRS))
SRC :=
include $(patsubst %, %/Module.make, $(MODULES))
OBJ := $(patsubst %.c, %.o, $(SRC))
OBJ := $(join $(addsuffix $(OBJDIR)/,$(dir $(OBJ))),$(notdir $(OBJ)))
2004-04-23 18:27:26 -06:00
SRC_ALL = $(SRC)
OBJ_ALL = $(OBJ)
.SUFFIXES: .c .o
2002-12-01 18:43:11 -07:00
.PHONY: make-objdir all-src
2004-04-23 18:27:26 -06:00
all: all-src stratagus$(EXE)
2000-03-25 15:38:54 -07:00
2002-12-01 18:43:11 -07:00
make-objdir:
2002-12-17 18:08:27 -07:00
@for i in $(MODULES); do \
2002-12-01 18:43:11 -07:00
if [ ! -d $$i/$(OBJDIR) ]; then mkdir $$i/$(OBJDIR); fi; done
2002-12-10 15:50:30 -07:00
%.o: $(@D)../%.c
2002-12-01 18:43:11 -07:00
$(CC) -c $(CFLAGS) $< -o $@
2000-03-25 15:38:54 -07:00
help:
@-echo "make cycle clean,depend,tags,all"
@-echo "make install install all files"
@-echo "make uninstall uninstall all files"
@-echo "make run create and run"
@-echo "make runp create and run with profiler"
@-echo "make clean cleanup keep only executables"
@-echo "make distclean clean all files"
@-echo "make doc make source documention with doxygen"
@-echo "make doc++ make source documention with doc++"
@-echo "make lockver NAME="version" label current version with symbolic name"
2003-07-03 09:35:45 -06:00
@-echo "make strip strip stratagus and/or stratagus.exe"
2000-03-25 15:38:54 -07:00
@-echo "make tags create ctags"
@-echo "make depend create dependencies"
@-echo "make dist create distribution"
@-echo "make win32new (CROSS-COMPILER ONLY) start new win32"
@-echo "make win32 (CROSS-COMPILER ONLY) build the win32 version"
@-echo "make win32distclean (CROSS-COMPILER ONLY) clean all files of win32"
2000-03-25 15:38:54 -07:00
@-echo "make release release it"
cycle::
@$(MAKE) clean
@$(MAKE) depend
@$(MAKE) tags
@$(MAKE) all
run::
2003-07-03 09:35:45 -06:00
@$(MAKE) && ./stratagus
2000-03-25 15:38:54 -07:00
runp::
2003-07-03 09:35:45 -06:00
@$(MAKE) && ./stratagus && if [ -e gmon.sum ]; then \
gprof -s stratagus gmon.out gmon.sum; \
2000-03-25 15:38:54 -07:00
else mv gmon.out gmon.sum; fi
doc::
2003-07-03 09:35:45 -06:00
doxygen contrib/doxygen-stratagus.cfg
2000-03-25 15:38:54 -07:00
doc++::
@$(MAKE) -C src RULESFILE=$(RULESFILE) doc
2000-03-25 15:38:54 -07:00
@if [ ! -d srcdoc ]; then mkdir srcdoc; fi
@$(DOCPP) -v -H -A -a -b -c -j -d srcdoc `find . -name "*.doc" -print`
2002-12-01 18:43:11 -07:00
all-src: make-objdir $(OBJ)
2000-03-25 15:38:54 -07:00
# UNIX-TARGET
2003-07-03 09:35:45 -06:00
stratagus: $(OBJ)
$(CCLD) -o stratagus $^ $(STRATAGUS_LIBS) -I. $(CFLAGS)
2000-03-25 15:38:54 -07:00
# WIN32-TARGET
2004-05-15 05:26:14 -06:00
stratagus.exe: $(OBJ) \
2003-07-03 09:35:45 -06:00
src/$(OBJDIR)/stratagusrc.$(OE)
$(CCLD) -o stratagus$(EXE) $^ -lSDLmain $(STRATAGUS_LIBS) -I. $(CFLAGS)
2000-03-25 15:38:54 -07:00
2002-04-05 12:18:27 -07:00
strip:
2003-07-03 09:35:45 -06:00
@if [ -f stratagus ]; then strip stratagus; fi
@if [ -f stratagus.exe ]; then $(CROSSDIR)/i386-mingw32msvc/bin/strip stratagus.exe; fi
2002-04-05 12:18:27 -07:00
2003-07-03 09:35:45 -06:00
src/$(OBJDIR)/stratagusrc.$(OE): src/stratagus.rc
2003-05-14 14:59:11 -06:00
if [ ! -d src/$(OBJDIR) ]; then mkdir src/$(OBJDIR); fi
2004-05-22 16:23:16 -06:00
cd src; windres -o $(OBJDIR)/stratagusrc.$(OE) stratagus.rc; cd ..
2000-03-25 15:38:54 -07:00
2001-09-23 12:36:29 -06:00
echo::
@-echo CFLAGS: $(CFLAGS)
2003-07-03 09:34:53 -06:00
@-echo LIBS: $(STRATAGUS_LIBS)
2001-09-23 12:36:29 -06:00
2000-03-25 15:38:54 -07:00
clean::
2002-12-01 19:01:28 -07:00
for i in $(MODULES_ALL); do \
2002-11-29 16:41:55 -07:00
$(RM) -rf $$i/$(OBJDIR)/*.o $$i/*.doc; done
2004-05-15 05:26:14 -06:00
$(RM) core gmon.out cscope.out *.doc
@echo
2000-03-25 15:38:54 -07:00
distclean: clean
2002-12-01 19:01:28 -07:00
for i in $(MODULES_ALL); do \
[ $(OBJDIR) == "." ] || $(RM) -rf $$i/$(OBJDIR); \
$(RM) $$i/.#* $$i/*~; done
2003-12-23 10:31:14 -07:00
$(RM) stratagus$(EXE) gmon.sum .depend .#* *~ stderr.txt stdout.txt \
2004-01-21 15:29:40 -07:00
srcdoc/* .depend Rules.make config.log config.status configure
$(RM) -rf autom4te.cache/
2000-03-25 15:38:54 -07:00
@echo
2004-02-16 18:53:55 -07:00
configure:
autoconf
./configure --enable-static
configuregl:
autoconf
./configure --enable-static --enable-opengl
2004-02-16 18:53:55 -07:00
lockver:
$(LOCKVER) Makefile $(RULESFILE) .indent.pro \
2003-07-03 09:35:45 -06:00
contrib/doxygen-stratagus.cfg \
$(CCLS) $(DOCS) $(SRC_ALL) src/beos/beos.cpp $(HDRS) Makefile
for i in $(MODULES_ALL); do $(LOCKVER) Module.make; done
2000-03-25 15:38:54 -07:00
tags:
2004-04-23 18:27:26 -06:00
for i in $(SRC); do \
ctags --c-types=defmpstuvx -a -f tags `pwd`/$$i ; done
2000-03-25 15:38:54 -07:00
depend:
@echo -n >.depend
2003-03-07 14:51:42 -07:00
@echo
2003-02-11 11:49:00 -07:00
@for i in $(SRC) ; do\
2003-03-07 14:57:56 -07:00
echo -e "\rMaking dependencies for $$i";\
echo -n `dirname $$i`/$(OBJDIR)/ >> .depend;\
$(CC) -MM $(IFLAGS) $(DFLAGS) $(CFLAGS) $$i >>.depend ; done
2003-03-07 14:51:42 -07:00
@echo
##############################################################################
#
# include dependency files, if they exist
#
2004-04-28 22:40:58 -06:00
$(OBJ): $(RULESFILE)
ifeq (.depend,$(wildcard .depend))
include .depend
endif
2000-03-25 15:38:54 -07:00
##############################################################################
# Distributions
##############################################################################
2004-02-17 09:21:44 -07:00
DOCS = README doc/*.html doc/*.txt doc/ccl/*.html doc/ccl/*.py \
doc/graphics/*.html doc/graphics/*.gimp doc/graphics/*.png
2000-03-25 15:38:54 -07:00
2004-02-17 08:59:37 -07:00
PICS = contrib/stratagus.ico
CONTRIB = contrib/macosx.tgz
2000-03-25 15:38:54 -07:00
2004-02-17 09:21:44 -07:00
MISC += Makefile Rules.make.orig \
2003-07-03 09:35:45 -06:00
contrib/doxygen-stratagus.cfg contrib/doxygen-header.html \
2004-02-17 09:21:44 -07:00
Rules.make.in configure.in configure \
src/stratagus.rc stratagus.dsw stratagus.dsp \
$(patsubst %, %/Module.make, $(MODULES)) \
2004-04-23 18:27:26 -06:00
$(patsubst %, %/Module.make, $(INCLUDE_DIRS))
2000-03-25 15:38:54 -07:00
mydate = $(shell date +%y%m%d)
2003-07-03 09:35:45 -06:00
distdir = stratagus-$(mydate)
2000-03-25 15:38:54 -07:00
2004-02-17 10:01:51 -07:00
#why is this needed?
DISTLIST = distlist.tmp
distlist:
@echo $(SRC_ALL) $(HDRS) src/beos/beos.cpp > $(DISTLIST)
dist: distlist
2004-02-17 10:01:51 -07:00
autoconf
2000-03-25 15:38:54 -07:00
echo >>$(DISTLIST)
echo $(PICS) >>$(DISTLIST)
echo $(MISC) >>$(DISTLIST)
echo $(DOCS) >>$(DISTLIST)
2004-02-17 08:59:37 -07:00
echo $(CONTRIB) >>$(DISTLIST)
2000-03-25 15:38:54 -07:00
rm -rf $(distdir)
mkdir $(distdir)
chmod 777 $(distdir)
2001-03-13 09:44:22 -07:00
for i in `cat $(DISTLIST)`; do echo $$i; done | cpio -pdml --quiet $(distdir)
chmod -R a+rX $(distdir)
2003-02-27 13:40:12 -07:00
tar czhf $(distdir)-src.tar.gz $(distdir)
2004-02-17 09:21:44 -07:00
echo "(c) 2004 The Stratagus Project" | \
2003-02-27 13:40:12 -07:00
zip -zq9r $(distdir)-src.zip $(distdir)
2000-03-25 15:38:54 -07:00
$(RM) $(DISTLIST)
$(RM) -r $(distdir)
2003-02-27 13:40:12 -07:00
du -h $(distdir)-src.tar.gz $(distdir)-src.zip
2000-03-25 15:38:54 -07:00
bin-dist: all
2000-03-25 15:38:54 -07:00
$(RM) $(DISTLIST)
echo $(DOCS) >>$(DISTLIST)
2003-07-03 09:35:45 -06:00
echo stratagus$(EXE) >>$(DISTLIST)
2000-03-25 15:38:54 -07:00
rm -rf $(distdir)
mkdir $(distdir)
chmod 777 $(distdir)
2001-03-13 09:44:22 -07:00
for i in `cat $(DISTLIST)`; do echo $$i; done | cpio -pdml --quiet $(distdir)
chmod -R a+rX $(distdir)
2003-07-03 09:35:45 -06:00
strip -s -R .comment $(distdir)/stratagus$(EXE)
tar czhf stratagus-$(mydate)-linux.tar.gz $(distdir)
2000-03-25 15:38:54 -07:00
$(RM) $(DISTLIST)
$(RM) -r $(distdir)
bin-dist-gl: all
$(RM) $(DISTLIST)
echo $(DOCS) >>$(DISTLIST)
echo stratagus$(EXE) >>$(DISTLIST)
rm -rf $(distdir)
mkdir $(distdir)
chmod 777 $(distdir)
for i in `cat $(DISTLIST)`; do echo $$i; done | cpio -pdml --quiet $(distdir)
chmod -R a+rX $(distdir)
strip -s -R .comment $(distdir)/stratagus$(EXE)
tar czhf stratagus-$(mydate)-linux-gl.tar.gz $(distdir)
$(RM) $(DISTLIST)
$(RM) -r $(distdir)
2000-07-12 17:19:13 -06:00
#----------------------------------------------------------------------------
win32-bin-dist2: win32
2000-03-25 15:38:54 -07:00
@$(RM) $(DISTLIST)
@echo $(DOCS) >>$(DISTLIST)
2003-07-03 09:35:45 -06:00
@echo stratagus$(EXE) >>$(DISTLIST)
2000-03-25 15:38:54 -07:00
@rm -rf $(distdir)
@mkdir $(distdir)
@chmod 777 $(distdir)
2001-03-13 09:44:22 -07:00
@for i in `cat $(DISTLIST)`; do echo $$i; done | cpio -pdml --quiet $(distdir)
@chmod -R a+rX $(distdir)
2003-07-03 09:35:45 -06:00
@strip -s -R .comment $(distdir)/stratagus$(EXE)
@echo "(c) 2003 by the Stratagus Project http://Stratagus.Org" | \
zip -zq9r stratagus-$(mydate)-win32bin.zip $(distdir)
2000-03-25 15:38:54 -07:00
@$(RM) $(DISTLIST)
@$(RM) -r $(distdir)
2003-07-03 09:35:45 -06:00
du -h stratagus-$(mydate)-win32bin.zip
2000-03-25 15:38:54 -07:00
2000-06-26 16:44:13 -06:00
win32-bin-dist: win32
@export PATH=$(CROSSDIR)/i386-mingw32msvc/bin:$(CROSSDIR)/bin:$$PATH; \
$(MAKE) RULESFILE=$(WINRULESFILE) $(WIN32) win32-bin-dist2
2000-06-26 16:44:13 -06:00
2000-07-12 17:19:13 -06:00
#----------------------------------------------------------------------------
2003-07-03 09:35:45 -06:00
difffile= stratagus-`date +%y%m%d`.diff
2001-03-13 09:44:22 -07:00
diff:
2000-03-25 15:38:54 -07:00
@$(RM) $(difffile)
@$(RM) $(DISTLIST)
$(MAKE) -C src RULESFILE=$(RULESFILE) distlist
2000-03-25 15:38:54 -07:00
echo $(MISC) >>$(DISTLIST)
echo $(DOCS) >>$(DISTLIST)
rcsdiff -u `cat $(DISTLIST)` > $(difffile)
release:
2000-06-26 16:44:13 -06:00
$(MAKE) distclean
2004-02-16 18:53:55 -07:00
$(MAKE) configure
2000-06-26 16:44:13 -06:00
$(MAKE) depend
2001-07-23 17:52:00 -06:00
$(MAKE) bin-dist
$(MAKE) configuregl
$(MAKE) depend
$(MAKE) bin-dist-gl
$(MAKE) win32new
2004-02-16 18:53:55 -07:00
$(MAKE) win32configure
$(MAKE) win32-bin-dist
$(MAKE) win32distclean
2000-07-12 17:19:13 -06:00
$(MAKE) dist
2000-03-25 15:38:54 -07:00
##############################################################################
# WIN32 Crosscompiler Build
##############################################################################
WIN32= \
VIDEOLIB='-L$(CROSSDIR)/i386-mingw32msvc/lib $(SDLLIB) -lwsock32 -lws2_32' \
RULESFILE=$(WINRULESFILE)
2000-03-25 15:38:54 -07:00
win32new:
@$(MAKE) RULESFILE=$(WINRULESFILE) distclean
export PATH=$(CROSSDIR)/i386-mingw32msvc/bin:$(CROSSDIR)/bin:$$PATH; \
2004-02-16 18:53:55 -07:00
win32configure:
autoconf
export PATH=$(CROSSDIR)/bin:$(CROSSDIR)/i386-mingw32msvc/bin:$$PATH; \
2004-02-16 18:53:55 -07:00
./configure --enable-win32 --host=i386-mingw32msvc --build=i386-linux \
--with-lua=/usr/local/cross --enable-static
2000-03-25 15:38:54 -07:00
win32_2:
2002-03-27 13:37:46 -07:00
$(MAKE) $(WIN32) all
2000-03-25 15:38:54 -07:00
win32:
export PATH=$(CROSSDIR)/i386-mingw32msvc/bin:$(CROSSDIR)/bin:$$PATH; \
$(MAKE) $(WIN32) win32_2
2000-03-25 15:38:54 -07:00
2004-02-02 13:46:53 -07:00
win32depend:
export PATH=$(CROSSDIR)/i386-mingw32msvc/bin:$(CROSSDIR)/bin:$$PATH; \
$(MAKE) $(WIN32) depend
2000-03-25 15:38:54 -07:00
win32distclean:
export PATH=$(CROSSDIR)/i386-mingw32msvc/bin:$(CROSSDIR)/bin:$$PATH; \
2002-03-27 13:37:46 -07:00
$(MAKE) $(WIN32) distclean
2000-03-25 15:38:54 -07:00
##############################################################################
2001-03-13 09:44:22 -07:00
# INSTALL/UNINSTALL
2000-03-25 15:38:54 -07:00
##############################################################################
2004-04-23 18:27:26 -06:00
install: all install-stratagus
2002-03-29 18:53:19 -07:00
2003-07-03 09:35:45 -06:00
install-stratagus:
2004-02-17 10:01:51 -07:00
install -m 755 stratagus $(PREFIX)/bin
2003-07-03 09:35:45 -06:00
@echo installation of stratagus complete
2000-03-25 15:38:54 -07:00
uninstall:
2003-07-03 09:35:45 -06:00
@echo uninstalling stratagus and stratagus tools
rm $(PREFIX)/bin/stratagus
2004-02-17 10:01:51 -07:00
@echo uninstallation of stratagus complete
2002-03-29 18:53:19 -07:00