-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile.curses
105 lines (76 loc) · 2.47 KB
/
Makefile.curses
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# vi:syntax=make
ifneq ($(CALLER),MASTER)
include Makefile.inc
endif
# 1. Directories
OBJDIR_CURSES := $(OBJDIR)/curses
DEPDIR_CURSES := $(DEPDIR)/curses
GENDIR_CURSES := $(GENDIR)/curses
RESEXT_H_CURSES := $(GENDIR_CURSES)/resext.h
# 2. Files
BIN_CURSES := $(BINDIR)/$(DSEKAI)t
DSEKAI_C_FILES_CURSES_ONLY := \
src/main.c \
src/scparse.c \
unilayer/src/input/cursesi.c \
unilayer/src/graphics/cursesg.c \
unilayer/src/memory/fakem.c \
unilayer/src/save/file.c
DSEKAI_O_FILES_CURSES := \
$(addprefix $(OBJDIR_CURSES)/,$(subst .c,.o,$(DSEKAI_C_FILES))) \
$(addprefix $(OBJDIR_CURSES)/,$(subst .c,.o,$(DSEKAI_C_FILES_CURSES_ONLY))) \
$(addprefix $(OBJDIR_CURSES)/,$(subst .c,.o,$(DSEKAI_C_FILES_RES)))
# 1a. Packaging Manifest
CURSES_MANIFEST :=
ifeq ($(FMT_ASN),TRUE)
CURSES_MANIFEST += $(subst .json,.asn,$(DSEKAI_ASSETS_MAPS_JSON))
endif
ifeq ($(FMT_JSON),TRUE)
CURSES_MANIFEST += \
$(DSEKAI_ASSETS_MAPS_JSON) \
$(DSEKAI_ASSETS_TILESETS_JSON) \
$(DSEKAI_ASSETS_SCRIPTS)
endif
# 3. Programs
CC_CURSES := gcc
LD_CURSES := gcc
# 4. Arguments
# Disable a bunch of effects we can't represent in text mode.
DEFINES_CURSES := \
$(DEFINES_DSEKAI) \
$(DEFINES_DEPTH) \
$(DEFINES_RESOURCE) \
-DNO_ENGINE_POV \
-DNO_TRANSITIONS \
-DNO_ANIMATE \
-DNO_DRAW_ENGINE_BEHIND_MENU \
-DNO_GFX_CACHE \
-DNO_SMOOTH_WALK \
-DNO_DIRTY_TILES \
-DDISABLE_WEATHER_EFFECTS \
-DPLATFORM_CURSES
INCLUDES_CURSES := \
$(INCLUDES_UNILAYER) \
-I $(GENDIR_CURSES)
CFLAGS_CURSES := $(CFLAGS_GCC_GENERIC) $(FLAGS_GCC_SANITIZE) $(DEFINES_CURSES) $(INCLUDES_CURSES)
LDFLAGS_CURSES := $(LDFLAGS_GCC_GENERIC) $(FLAGS_GCC_SANITIZE) -lncurses
# 5. Targets
platform := curses
platform_upper := CURSES
res_gfx := $(DSEKAI_ASSETS_BITMAPS)
$(eval $(RESEXT_H_RULE))
pkg_bin := $(BIN_CURSES) $(CONVERT) $(MAP2ASN)
pkg_strip := strip
pkg_name := $(DSEKAI)-$(platform)-$(PKGOS)-$(GIT_HASH)
pkg_reqs := $(CURSES_MANIFEST)
$(eval $(PKG_RULE))
$(BIN_CURSES): $(DSEKAI_O_FILES_CURSES) | $(BINDIR)/$(STAMPFILE) $(RESEXT_H_CURSES)
$(LD_CURSES) -o $@ $^ $(LDFLAGS_CURSES)
$(OBJDIR_CURSES)/%.o: %.c $(RESEXT_H_CURSES) | $(DSEKAI_ASSETS_MAPS_JSON)
$(MD) $(dir $@)
$(CC_CURSES) $(CFLAGS_CURSES) -c -o $@ $(<:%.o=%)
#$(DEPDIR_CURSES)/%.d: %.c $(GENDIR_CURSES)/resext.h
# $(MD) $(dir $@)
# $(CC_CURSES) $(CFLAGS_CURSES) -MM $< \
# -MT $(subst .c,.o,$(addprefix $(DEPDIR_CURSES)/,$<)) -MF $@
#include $(subst $(OBJDIR)/,$(DEPDIR)/,$(DSEKAI_O_FILES_CURSES:.o=.d))