forked from hifi/q2admin
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
52 lines (38 loc) · 1.12 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
51
52
GIT_REV=$(shell git rev-parse --short HEAD)
ifeq ($(GIT_REV),)
GIT_REV=git
endif
REL_VERSION=2.0
VERSION=$(REL_VERSION)~$(GIT_REV)
# remember to update this for every release commit
RELEASE=no
ifeq ($(RELEASE),yes)
VERSION=$(REL_VERSION)
endif
LUA_CFLAGS = $(shell pkg-config --cflags lua5.1)
LUA_LDFLAGS = $(shell pkg-config --libs lua5.1)
LDFLAGS = -lm $(LUA_LDFLAGS)
CC=gcc
CFLAGS ?= -ffast-math -O3
ifdef DEBUG
CFLAGS = -O -g
endif
CFLAGS+=-Wall -Wextra -Werror -Wfatal-errors -fPIC $(LUA_CFLAGS)
PLATFORM=$(shell uname -s|tr A-Z a-z)
# only tested on linux currently
ifneq ($(PLATFORM),linux)
#ifneq ($(PLATFORM),freebsd)
#ifneq ($(PLATFORM),darwin)
$(error OS $(PLATFORM) is currently not supported)
#endif
#endif
endif
ARCH=$(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc/ -e s/sparc64/sparc/ -e s/arm.*/arm/ -e s/sa110/arm/ -e s/alpha/axp/)
SHLIBEXT=so
GAME_NAME=game$(ARCH).$(SHLIBEXT)
MAKE_FLAGS = CC=$(CC) CFLAGS="$(CFLAGS) -DQ2A_VERSION=\\\"$(VERSION)\\\"" LDFLAGS="$(LDFLAGS)" GAME_NAME=$(GAME_NAME)
all:
cd src && make -j2 all $(MAKE_FLAGS)
clean:
cd src && make clean $(MAKE_FLAGS)
rm -f $(GAME_NAME)