forked from Mapeadores/ZombieReloaded
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
50 lines (40 loc) · 1.27 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# Script made by [SG-10]Cpt.Moore
# Note that this script will convert line endings in source files to LF.
SOURCEDIR=src
SMINCLUDES=env/include
ZRINCLUDES=src/include
BUILDDIR=build
SPCOMP_LINUX=env/linux/bin/spcomp-1.7.0
SPCOMP_DARWIN=env/darwin/bin/spcomp-1.7.0
DOS2UNIX_LINUX=dos2unix
DOS2UNIX_DARWIN=env/darwin/bin/dos2unix -p
VERSIONDUMP=./updateversion.sh
OS = $(shell uname -s)
ifeq "$(OS)" "Darwin"
SPCOMP = $(SPCOMP_DARWIN)
DOS2UNIX = $(DOS2UNIX_DARWIN)
else
SPCOMP = $(SPCOMP_LINUX)
DOS2UNIX = $(DOS2UNIX_LINUX)
endif
vpath %.sp $(SOURCEDIR)
vpath %.inc $(SOURCEDIR)/zr
vpath %.smx $(BUILDDIR)
SOURCEFILES=$(SOURCEDIR)/*.sp
OBJECTS=$(patsubst %.sp, %.smx, $(notdir $(wildcard $(SOURCEFILES))))
all: prepare_builddir $(OBJECTS)
prepare: prepare_newlines prepare_builddir
prepare_newlines:
@echo "Removing windows newlines"
@find $(SOURCEDIR) -name \*.inc -exec $(DOS2UNIX) "{}" \;
@find $(SOURCEDIR) -name \*.sp -exec $(DOS2UNIX) "{}" \;
@find $(SMINCLUDES) -name \*.inc -exec $(DOS2UNIX) "{}" \;
@find $(ZRINCLUDES) -name \*.inc -exec $(DOS2UNIX) "{}" \;
prepare_builddir:
@mkdir -p $(BUILDDIR)
%.smx: %.sp
$(VERSIONDUMP)
$(SPCOMP) -i$(SOURCEDIR) -i$(SMINCLUDES) -i$(ZRINCLUDES) -o$(BUILDDIR)/$@ $<
clean:
@echo "Removing build directory"
@rm -fr $(BUILDDIR)