-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
82 lines (59 loc) · 1.58 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
76
77
78
79
80
81
82
-include config.mk
INPUT = game.dat
OUTPUT = game.exe
LDS = game.lds
IMPORTS = 0x1ECEB0 320
LD_CFLAGS = -Wl,--section-alignment=0x1000 -Wl,--subsystem=windows -Wl,--enable-stdcall-fixup
LDFLAGS = --file-alignment=0x1000 --section-alignment=0x1000 --subsystem=windows --enable-stdcall-fixup
NFLAGS = -f elf -Iinc/
CFLAGS = -std=c99 -Iinc/
CLIBS = -L./ -lpsapi
REV = $(shell git rev-parse --short @{0})
VERSION = SOFT_VERSION-CnCNet-patch-$(REV)
WINDRES_FLAGS = --preprocessor-arg -DVERSION="$(VERSION)"
PETOOL ?= petool
STRIP ?= strip
WINDRES ?= windres
OBJS = \
src/window_name.o \
src/copy-protection_bullshit.o \
src/copy-protection.o \
src/LoadLibs.o
SPAWNER_OBJS = \
# src/spawner/nethack.o
ifdef SPAWNER
OBJS += $(SPAWNER_OBJS)
endif
ifdef WIN8
OBJS += src/win8_compat-func.o \
src/win8_compat.o
endif
ifdef IGDEBUG
NFLAGS += -D IGDEBUG
CFLAGS += -D IGDEBUG
OBJS += src/emperor_util.o
endif
OBJS += res/res.o \
sym.o
PETOOL ?= petool
STRIP ?= strip
NASM ?= nasm
PETOOL ?= petool
STRIP ?= strip
NASM ?= nasm
.PHONY: default
default: $(OUTPUT)
.PHONY: all
all: $(OUTPUT)
%.o: %.asm
$(NASM) $(NFLAGS) -o $@ $<
%.o: %.rc
$(WINDRES) $(WINDRES_FLAGS) $< $@
$(OUTPUT): $(LDS) $(INPUT) $(OBJS)
$(LD) $(LDFLAGS) -T $(LDS) -o $@ $(OBJS)
$(PETOOL) setdd $@ 1 $(IMPORTS) || ($(RM) $@ && exit 1)
$(PETOOL) patch $@ || ($(RM) $@ && exit 1)
$(STRIP) -R .patch $@ || ($(RM) $@ && exit 1)
$(PETOOL) dump $@
clean:
$(RM) $(OUTPUT) $(ARES_OBJS) $(DLL_OBJS) $(OBJS)