forked from diasurgical/devilution
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MakefileVC
88 lines (68 loc) · 3.12 KB
/
MakefileVC
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
VC5_DIR ?= $(HOME)/DevStudio_5.10/VC
# The $(VS6_DIR) directory is a copy of the "Microsoft Visual Studio" directory.
#
# To get a working setup on Linux or other "portable" copies of VS,
# the following DLLs have to be copied to the
# $(VS6_DIR)/VC98/Bin directory.
#
# - $(VS6_DIR)/Common/MSDev98/Bin/MSPDB60.DLL
#
# And to the $(VC5_DIR)/bin directory.
#
# - $(VC5_DIR)/SharedIDE/bin/MSDIS100.DLL
# - $(VC5_DIR)/SharedIDE/bin/MSPDB50.DLL
VS6_DIR ?= $(HOME)/VS6
VC6_DIR = $(VS6_DIR)/VC98
VC6_BIN_DIR = $(VC6_DIR)/Bin
VC6_INC_DIR = $(VC6_DIR)/Include
VC6_LIB_DIR = $(VC6_DIR)/Lib
VC5_LIB_DIR = $(VC5_DIR)/lib
IDE_DIR ?= $(VS6_DIR)/Common/MSDev98
IDE_BIN_DIR = $(IDE_DIR)/bin
ifeq ($(OS),Windows_NT)
CL = $(VC6_BIN_DIR)/CL.EXE
RC = $(IDE_BIN_DIR)/RC.EXE
VC5_LINK = $(VC5_DIR)/bin/link.exe
VC6_LINK = $(VC6_BIN_DIR)/link.exe
else
CL = wine $(VC6_BIN_DIR)/CL.EXE
RC = wine $(IDE_BIN_DIR)/RC.EXE
VC5_LINK = wine $(VC5_DIR)/bin/link.exe
VC6_LINK = wine $(VC6_BIN_DIR)/link.exe
endif
CFLAGS=/nologo /c /GX /W3 /O1 /I $(VC6_INC_DIR) /FD /MT /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /Fp"Diablo.pch" /YX /Gm /Zi
LINKFLAGS=/nologo /subsystem:windows /machine:I386 /incremental:no
ifeq ($(MAKE_BUILD),pdb)
VC_LINK = $(VC6_LINK)
LINKFLAGS += /pdb:"Diablo.pdb" /LIBPATH:$(VC6_LIB_DIR) /debug
else
VC_LINK=$(VC5_LINK)
LINKFLAGS+= /LIBPATH:$(VC5_LIB_DIR)
endif
all: Diablo.exe
# fix compilation order to match the VC6 workspace files
DIABLO_SRC=$(sort $(filter-out Source/render.cpp, $(wildcard Source/*.cpp)))
DIABLO_SRC += Source/render.cpp
OBJS=$(DIABLO_SRC:.cpp=.obj)
PKWARE_SRC=$(sort $(wildcard 3rdParty/PKWare/*.cpp))
PKWARE_OBJS=$(PKWARE_SRC:.cpp=.obj)
STORM_SRC=$(sort $(wildcard 3rdParty/Storm/Source/*.cpp))
STORM_OBJS=$(STORM_SRC:.cpp=.obj)
DIABLOUI_SRC=DiabloUI/diabloui.cpp
DIABLOUI_OBJS=$(DIABLOUI_SRC:.cpp=.obj)
Diablo.exe: main_files $(PKWARE_OBJS) diablo.res DiabloUI/diabloui.lib 3rdParty/Storm/Source/storm.lib
$(VC_LINK) /OUT:$@ $(LINKFLAGS) $(OBJS) $(PKWARE_OBJS) diablo.res advapi32.lib gdi32.lib shell32.lib user32.lib version.lib DiabloUI/diabloui.lib 3rdParty/Storm/Source/storm.lib
DiabloUI/diabloui.lib: $(DIABLOUI_OBJS) 3rdParty/Storm/Source/storm.lib
$(CL) $^ /link /LINK50COMPAT /nologo /dll /subsystem:windows /machine:I386 /LIBPATH:$(VC6_LIB_DIR) DiabloUI/diabloui.res advapi32.lib gdi32.lib shell32.lib user32.lib version.lib 3rdParty/Storm/Source/storm.lib /def:"DiabloUI/diabloui.def" /out:DiabloUI/diabloui.dll
3rdParty/Storm/Source/storm.lib: $(STORM_OBJS)
$(CL) $^ /link /LINK50COMPAT /nologo /dll /subsystem:windows /machine:I386 /LIBPATH:$(VC6_LIB_DIR) /def:"3rdParty/Storm/Source/storm.def" /out:3rdParty/Storm/Source/storm.dll
# compiles all main source files with once compiler call
main_files:
$(CL) $(CFLAGS) /FoSource/ $(DIABLO_SRC)
%.obj: %.cpp
$(CL) $(CFLAGS) /Fo$@ $<
diablo.res: Diablo.rc
$(RC) /i $(VC6_INC_DIR) /i $(VC6_DIR)/MFC/Include /l 0x409 /fo $@ $<
clean:
@$(RM) -v $(OBJS) $(PKWARE_OBJS) $(STORM_OBJS) $(DIABLOUI_OBJS) DiabloUI/diabloui.{exp,lib,dll} 3rdParty/Storm/Source/storm.{exp,lib,dll}
.PHONY: clean all