-
Notifications
You must be signed in to change notification settings - Fork 114
/
Copy pathMakefile
75 lines (59 loc) · 1.73 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
include config.mk
cflags := -Isrc/brogue -Isrc/platform -std=c99 \
-Wall -Wpedantic -Werror=implicit -Wno-parentheses -Wno-unused-result \
-Wformat -Werror=format-security -Wformat-overflow=0
libs := -lm
cppflags := -DDATADIR=$(DATADIR)
sources := $(wildcard src/brogue/*.c) $(addprefix src/platform/,main.c platformdependent.c)
objects :=
ifeq ($(SYSTEM),WINDOWS)
objects += windows/icon.o
.exe := .exe
endif
ifeq ($(RELEASE),YES)
extra_version :=
else
extra_version := $(shell bash tools/git-extra-version)
endif
cppflags += -DBROGUE_EXTRA_VERSION='"$(extra_version)"'
ifeq ($(TERMINAL),YES)
sources += $(addprefix src/platform/,curses-platform.c term.c)
cppflags += -DBROGUE_CURSES
libs += -lncurses
endif
ifeq ($(GRAPHICS),YES)
sources += $(addprefix src/platform/,sdl2-platform.c tiles.c)
cflags += $(shell $(SDL_CONFIG) --cflags)
cppflags += -DBROGUE_SDL
libs += $(shell $(SDL_CONFIG) --libs) -lSDL2_image
endif
ifeq ($(WEBBROGUE),YES)
sources += $(addprefix src/platform/,web-platform.c)
cppflags += -DBROGUE_WEB
endif
ifeq ($(MAC_APP),YES)
cppflags += -DSDL_PATHS
endif
ifeq ($(DEBUG),YES)
cflags += -g -Og
cppflags += -DENABLE_PLAYBACK_SWITCH
else
cflags += -O2
endif
# Add user-provided flags.
cflags += $(CFLAGS)
cppflags += $(CPPFLAGS)
libs += $(LDLIBS)
objects += $(sources:.c=.o)
include make/*.mk
.DEFAULT_GOAL := bin/brogue$(.exe)
clean:
$(warning 'make clean' is no longer needed in many situations, so is not supported. Use 'make -B' to force rebuild something.)
escape = $(subst ','\'',$(1))
vars:
mkdir vars
# Write the value to a temporary file and only overwrite if it's different.
vars/%: vars FORCE
@echo '$(call escape,$($*))' > vars/$*.tmp
@if cmp --quiet vars/$*.tmp vars/$*; then :; else cp vars/$*.tmp vars/$*; fi
FORCE: