2010-04-05 01:40:29 +02:00
|
|
|
# Script made by [SG-10]Cpt.Moore
|
2012-01-28 02:16:49 +01:00
|
|
|
# Note that this script will convert line endings in source files to LF.
|
2008-10-04 22:59:11 +02:00
|
|
|
|
|
|
|
SOURCEDIR=src
|
2009-08-27 19:53:52 +02:00
|
|
|
SMINCLUDES=env/include
|
2016-04-22 01:24:10 +02:00
|
|
|
ZRINCLUDES=src/include
|
2008-10-04 22:59:11 +02:00
|
|
|
BUILDDIR=build
|
2015-03-21 15:43:24 +01:00
|
|
|
SPCOMP_LINUX=env/linux/bin/spcomp-1.7.0
|
|
|
|
SPCOMP_DARWIN=env/darwin/bin/spcomp-1.7.0
|
2016-04-22 01:24:10 +02:00
|
|
|
DOS2UNIX_LINUX=dos2unix
|
2012-01-28 02:16:49 +01:00
|
|
|
DOS2UNIX_DARWIN=env/darwin/bin/dos2unix -p
|
2009-08-23 06:19:15 +02:00
|
|
|
VERSIONDUMP=./updateversion.sh
|
2008-10-04 22:59:11 +02:00
|
|
|
|
2012-01-28 02:16:49 +01:00
|
|
|
OS = $(shell uname -s)
|
|
|
|
ifeq "$(OS)" "Darwin"
|
|
|
|
SPCOMP = $(SPCOMP_DARWIN)
|
|
|
|
DOS2UNIX = $(DOS2UNIX_DARWIN)
|
|
|
|
else
|
|
|
|
SPCOMP = $(SPCOMP_LINUX)
|
|
|
|
DOS2UNIX = $(DOS2UNIX_LINUX)
|
|
|
|
endif
|
|
|
|
|
2008-10-04 22:59:11 +02:00
|
|
|
vpath %.sp $(SOURCEDIR)
|
2010-11-14 15:17:19 +01:00
|
|
|
vpath %.inc $(SOURCEDIR)/zr
|
2008-10-04 22:59:11 +02:00
|
|
|
vpath %.smx $(BUILDDIR)
|
|
|
|
|
|
|
|
SOURCEFILES=$(SOURCEDIR)/*.sp
|
|
|
|
OBJECTS=$(patsubst %.sp, %.smx, $(notdir $(wildcard $(SOURCEFILES))))
|
|
|
|
|
2016-06-12 14:07:44 +02:00
|
|
|
all: prepare_builddir $(OBJECTS)
|
2008-10-04 22:59:11 +02:00
|
|
|
|
|
|
|
prepare: prepare_newlines prepare_builddir
|
|
|
|
|
|
|
|
prepare_newlines:
|
|
|
|
@echo "Removing windows newlines"
|
2016-04-22 01:24:10 +02:00
|
|
|
@find $(SOURCEDIR) -name \*.inc -exec $(DOS2UNIX) "{}" \;
|
|
|
|
@find $(SOURCEDIR) -name \*.sp -exec $(DOS2UNIX) "{}" \;
|
|
|
|
@find $(SMINCLUDES) -name \*.inc -exec $(DOS2UNIX) "{}" \;
|
|
|
|
@find $(ZRINCLUDES) -name \*.inc -exec $(DOS2UNIX) "{}" \;
|
2008-10-04 22:59:11 +02:00
|
|
|
|
|
|
|
prepare_builddir:
|
|
|
|
@echo "Creating build directory"
|
|
|
|
@mkdir -p $(BUILDDIR)
|
|
|
|
|
|
|
|
%.smx: %.sp
|
2009-08-23 06:19:15 +02:00
|
|
|
$(VERSIONDUMP)
|
2016-04-22 01:24:10 +02:00
|
|
|
$(SPCOMP) -i$(SOURCEDIR) -i$(SMINCLUDES) -i$(ZRINCLUDES) -o$(BUILDDIR)/$@ $<
|
2008-10-04 22:59:11 +02:00
|
|
|
|
|
|
|
clean:
|
|
|
|
@echo "Removing build directory"
|
|
|
|
@rm -fr $(BUILDDIR)
|