-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile.win386
139 lines (102 loc) · 3.25 KB
/
Makefile.win386
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# vi:syntax=make
ifneq ($(CALLER),MASTER)
include Makefile.inc
endif
# 1. Directories
OBJDIR_WIN386 := $(OBJDIR)/win386
DEPDIR_WIN386 := $(DEPDIR)/win386
GENDIR_WIN386 := $(GENDIR)/win386
# 2. Files
BIN_WIN386 := $(BINDIR)/$(DSEKAI)le.exe
DSEKAI_C_FILES_WIN386_ONLY := \
src/main.c \
src/pov.c \
src/scparse.c \
unilayer/src/animate.c \
unilayer/src/input/wini.c \
unilayer/src/memory/fakem.c \
unilayer/src/graphics/wing.c \
unilayer/src/save/file.c
ifeq ($(RESOURCE),DEFAULT)
DSEKAI_C_FILES_WIN386_ONLY += unilayer/src/resource/winr.c
else
DSEKAI_C_FILES_WIN386_ONLY += $(DSEKAI_C_FILES_RES)
endif
DSEKAI_O_FILES_WIN386 := \
$(addprefix $(OBJDIR_WIN386)/,$(subst .c,.o,$(DSEKAI_C_FILES))) \
$(addprefix $(OBJDIR_WIN386)/,$(subst .c,.o,$(DSEKAI_C_FILES_WIN386_ONLY)))
WIN386_RES_FILES := src/winstat.rc
ifeq ($(RESOURCE),DEFAULT)
WIN386_RES_FILES += $(GENDIR_WIN386)/win.rc
endif
#WIN386_RES_FILES += $(ASSETDIR)/$(DSEKAI).ico
# 1a. Packaging Manifest
WIN386_MANIFEST :=
ifeq ($(RESOURCE),FILE)
WIN386_MANIFEST += $(DSEKAI_ASSETS_BITMAPS)
endif
ifeq ($(FMT_ASN),TRUE)
WIN386_MANIFEST += $(subst .json,.asn,$(DSEKAI_ASSETS_MAPS_JSON))
endif
ifeq ($(FMT_JSON),TRUE)
WIN386_MANIFEST += \
$(DSEKAI_ASSETS_MAPS_JSON) \
$(DSEKAI_ASSETS_TILESETS_JSON)
endif
RESEXT_H_WIN386 := $(GENDIR_WIN386)/resext.h
# 3. Programs
CC_WIN386 := wcc386
LD_WIN386 := wcl386
RC_WIN386 := wrc
# 4. Arguments
DEFINES_WIN386 := \
$(DEFINES_DSEKAI) \
$(DEFINES_DEPTH) \
-DPLATFORM_WIN16 \
-DMEMORY_FAKE
INCLUDES_WIN386 := \
$(subst -I ,-i=,$(INCLUDES_UNILAYER)) \
-i=$(GENDIR_WIN386) \
-i=$(INCLUDE)/win
CFLAGS_WIN386 := -bt=windows -bw $(CFLAGS_OWC_GENERIC) $(DEFINES_WIN386) $(INCLUDES_WIN386)
LDFLAGS_WIN386 := -l=win386 $(LDFLAGS_OWC_GENERIC)
RCFLAGS_WIN386 := $(DEFINES_WIN386) -i=$(INCLUDE)win
ifneq ($(BUILD),RELEASE)
# Debug build.
CFLAGS_WIN386 += -DLOG_TO_FILE
LDFLAGS_WIN386 += -en -d3
endif
ifneq ($(RESOURCE),DEFAULT)
CFLAGS_WIN386 += $(subst -I ,-I=,$(DEFINES_RESOURCE))
endif
ifeq ($(RESOURCE),DEFAULT)
RCFLAGS_WIN386 += -DRESOURCE_WIN
endif
# 5. Targets
platform := win386
platform_upper := WIN386
res_gfx := $(DSEKAI_ASSETS_BITMAPS)
$(eval $(RESEXT_H_RULE))
pkg_bin := $(BIN_WIN386)
pkg_strip := echo
pkg_name := $(DSEKAI)-$(platform)-$(GIT_HASH)
pkg_reqs := $(WIN386_MANIFEST)
$(eval $(PKG_RULE))
$(BINDIR)/$(DSEKAI)le.img: $(BIN_WIN386)
$(DD) if=/dev/zero bs=512 count=2880 of="$@"
$(MKFSVFAT) "$@"
$(MCOPY) -i "$@" $< ::$(DSEKAI)le.exe
$(OBJDIR_WIN386)/$(DSEKAI)le.rex: \
$(DSEKAI_O_FILES_WIN386) | $(OBJDIR_WIN386)/$(STAMPFILE)
$(LD_WIN386) $(LDFLAGS_WIN386) -fe=$@ $^
$(BIN_WIN386): $(OBJDIR_WIN386)/$(DSEKAI)le.rex | $(BINDIR)/$(STAMPFILE)
wbind $< -s $(WATCOM)/binw/win386.ext -R $(WIN386_RES_FILES) $(RCFLAGS_WIN386) $(OBJDIR_WIN386)/$(DSEKAI)le.exe
mv -v $(OBJDIR_WIN386)/$(DSEKAI)le.exe $(BIN_WIN386)
$(OBJDIR_WIN386)/%.o: %.c $(RESEXT_H_WIN386)
$(MD) $(dir $@)
$(CC_WIN386) $(CFLAGS_WIN386) -fo=$@ $(<:%.c=%)
#$(DEPDIR_WIN386)/%.d: %.c $(RESEXT_H_WIN386)
# $(MD) $(dir $@)
# $(HOST_CC) $(subst -i=,-I ,$(INCLUDES_WIN386)) $(DEFINES_WIN386) -MM $< \
# -MT $(subst .c,.o,$(addprefix $(DEPDIR_WIN32)/,$<)) -MF $@
#include $(subst $(OBJDIR)/,$(DEPDIR)/,$(DSEKAI_O_FILES_WIN386:.o=.d))