Skip to content

Commit 340e1ae

Browse files
committed
MAKE: fixes for mingw and darwin builds
1 parent f9d05b9 commit 340e1ae

File tree

1 file changed

+48
-6
lines changed

1 file changed

+48
-6
lines changed

Makefile

Lines changed: 48 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,47 @@
1+
#
2+
# bspc Makefile
3+
#
4+
# GNU Make required
5+
#
6+
COMPILE_PLATFORM=$(shell uname | sed -e 's/_.*//' | tr '[:upper:]' '[:lower:]' | sed -e 's/\//_/g')
7+
COMPILE_ARCH=$(shell uname -m | sed -e 's/i.86/x86/' | sed -e 's/^arm.*/arm/')
8+
9+
ifeq ($(COMPILE_PLATFORM),sunos)
10+
# Solaris uname and GNU uname differ
11+
COMPILE_ARCH=$(shell uname -p | sed -e 's/i.86/x86/')
12+
endif
13+
14+
#############################################################################
15+
#
16+
# If you require a different configuration from the defaults below, create a
17+
# new file named "Makefile.local" in the same directory as this file and define
18+
# your parameters there. This allows you to change configuration without
19+
# causing problems with keeping up to date with the repository.
20+
#
21+
#############################################################################
22+
-include Makefile.local
23+
24+
ifeq ($(COMPILE_PLATFORM),cygwin)
25+
PLATFORM=mingw32
26+
endif
27+
28+
ifndef PLATFORM
29+
PLATFORM=$(COMPILE_PLATFORM)
30+
endif
31+
132
CC=gcc
233
CFLAGS=\
334
-Dstricmp=strcasecmp -DCom_Memcpy=memcpy -DCom_Memset=memset \
4-
-DMAC_STATIC= -DQDECL= -DLINUX -DBSPC -D_FORTIFY_SOURCE=2 \
35+
-DMAC_STATIC= -DQDECL= -DBSPC -D_FORTIFY_SOURCE=2 \
536
-fno-common \
6-
-I. -Ideps -Wall
37+
-I. -Ideps -Wall $(EXPAT_CFLAGS)
38+
39+
ifneq (,$(findstring "$(PLATFORM)", "linux" "gnu_kfreebsd" "kfreebsd-gnu" "gnu"))
40+
CFLAGS += -DHAVE_GETRANDOM -DLINUX
41+
endif
42+
ifeq ($(PLATFORM),darwin)
43+
CFLAGS += -DHAVE_ARC4RANDOM -DLINUX
44+
endif
745

846
RELEASE_CFLAGS=-O3 -ffast-math
947
DEBUG_CFLAGS=-g -O0 -ffast-math
@@ -80,20 +118,24 @@ GAME_OBJS = \
80118
#tetrahedron.o
81119

82120
EXEC = bspc
121+
ifdef MINGW
122+
BINEXT=.exe
123+
endif
124+
83125

84126
all: release
85127

86128
debug: CFLAGS += $(DEBUG_CFLAGS)
87-
debug: $(EXEC)_g
129+
debug: $(EXEC)_g$(BINEXT)
88130

89131
release: CFLAGS += $(RELEASE_CFLAGS)
90-
release: $(EXEC)
132+
release: $(EXEC)$(BINEXT)
91133

92-
$(EXEC): $(GAME_OBJS)
134+
$(EXEC)$(BINEXT): $(GAME_OBJS)
93135
$(CC) -o $@ $(GAME_OBJS) $(LDFLAGS)
94136
strip $@
95137

96-
$(EXEC)_g: $(GAME_OBJS)
138+
$(EXEC)_g$(BINEXT): $(GAME_OBJS)
97139
$(CC) -o $@ $(GAME_OBJS) $(LDFLAGS)
98140

99141
#############################################################################

0 commit comments

Comments
 (0)