-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile.xlib
109 lines (79 loc) · 2.36 KB
/
Makefile.xlib
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
104
105
106
107
108
# vi:syntax=make
ifneq ($(CALLER),MASTER)
include Makefile.inc
endif
ifneq ($(DEPTH),CGA)
ifneq ($(DEPTH),MONO)
$(error xlib target must be built with CGA DEPTH)
endif
endif
# 1. Directories
OBJDIR_XLIB := $(OBJDIR)/xlib
DEPDIR_XLIB := $(DEPDIR)/xlib
GENDIR_XLIB := $(GENDIR)/xlib
# 2. Files
BIN_XLIB := $(BINDIR)/$(DSEKAI)x
DSEKAI_C_FILES_XLIB_ONLY := \
src/main.c \
src/pov.c \
src/scparse.c \
unilayer/src/animate.c \
unilayer/src/input/xi.c \
unilayer/src/graphics/xg.c \
unilayer/src/memory/fakem.c \
unilayer/src/save/file.c
DSEKAI_O_FILES_XLIB := \
$(addprefix $(OBJDIR_XLIB)/,$(subst .c,.o,$(DSEKAI_C_FILES))) \
$(addprefix $(OBJDIR_XLIB)/,$(subst .c,.o,$(DSEKAI_C_FILES_XLIB_ONLY))) \
$(addprefix $(OBJDIR_XLIB)/,$(subst .c,.o,$(DSEKAI_C_FILES_RES)))
# 1a. Packaging Manifest
XLIB_MANIFEST :=
ifeq ($(RESOURCE),FILE)
XLIB_MANIFEST += $(DSEKAI_ASSETS_BITMAPS)
endif
ifeq ($(FMT_ASN),TRUE)
XLIB_MANIFEST += $(subst .json,.asn,$(DSEKAI_ASSETS_MAPS_JSON))
endif
ifeq ($(FMT_JSON),TRUE)
XLIB_MANIFEST += \
$(DSEKAI_ASSETS_MAPS_JSON) \
$(DSEKAI_ASSETS_TILESETS_JSON)
endif
RESEXT_H_XLIB := $(GENDIR_XLIB)/resext.h
# 3. Programs
CC_XLIB := gcc
LD_XLIB := gcc
# 4. Arguments
DEFINES_XLIB := \
$(DEFINES_DSEKAI) \
$(DEFINES_DEPTH) \
$(DEFINES_RESOURCE) \
-DPLATFORM_XLIB \
-DUSE_SOFTWARE_TEXT \
-DUSE_SOFTWARE_LINES \
-DSCREEN_SCALE=$(SCREEN_SCALE)
INCLUDES_XLIB := \
$(INCLUDES_UNILAYER) \
-I $(GENDIR_XLIB)
CFLAGS_XLIB := $(CFLAGS_GCC_GENERIC) $(FLAGS_GCC_SANITIZE) $(DEFINES_XLIB) $(INCLUDES_XLIB)
LDFLAGS_XLIB := -lX11 -lm $(LDFLAGS_GCC_GENERIC) $(FLAGS_GCC_SANITIZE)
# 5. Targets
platform := xlib
platform_upper := XLIB
res_gfx := $(DSEKAI_ASSETS_BITMAPS)
$(eval $(RESEXT_H_RULE))
pkg_bin := $(BIN_XLIB) $(CONVERT) $(MAP2ASN)
pkg_strip := strip
pkg_name := $(DSEKAI)-$(platform)-$(PKGOS)-$(GIT_HASH)
pkg_reqs := $(XLIB_MANIFEST)
$(eval $(PKG_RULE))
$(BIN_XLIB): $(DSEKAI_O_FILES_XLIB) | $(BINDIR)/$(STAMPFILE) $(RESEXT_H_XLIB)
$(LD_XLIB) -o $@ $^ $(LDFLAGS_XLIB)
$(OBJDIR_XLIB)/%.o: %.c $(RESEXT_H_XLIB)
$(MD) $(dir $@)
$(CC_XLIB) $(CFLAGS_XLIB) -c -o $@ $(<:%.o=%)
$(DEPDIR_XLIB)/%.d: %.c $(RESEXT_H_XLIB)
$(MD) $(dir $@)
$(CC_XLIB) $(CFLAGS_XLIB) -MM $< \
-MT $(subst .c,.o,$(addprefix $(DEPDIR_XLIB)/,$<)) -MF $@
#include $(subst $(OBJDIR)/,$(DEPDIR)/,$(DSEKAI_O_FILES_XLIB:.o=.d))