forked from miki151/keeperrl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile-win
130 lines (95 loc) · 2.52 KB
/
Makefile-win
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
GCC = $(PREFIX)g++
PKG_CONFIG = $(PREFIX)pkg-config
LD = $(GCC)
CFLAGS += -Wall -std=c++1y -Wno-sign-compare -Wno-unused-variable -Wno-strict-aliasing -Wl,--build-id -Wa,-mbig-obj
ifdef DATA_DIR
CFLAGS += -DDATA_DIR=\"$(DATA_DIR)\"
endif
ifdef DEBUG
GFLAG += -g
endif
NO_OMIT_FP = true
ifdef NO_OMIT_FP
GFLAG += -fno-omit-frame-pointer
endif
ifdef PROF
GFLAG += -pg
endif
ifdef RELEASE
GFLAG += -DRELEASE
endif
ifndef AMD64
GFLAG += -Wl,--large-address-aware
endif
ifdef STEAMWORKS
include Makefile-steam
endif
ifdef OPT
GFLAG += -O2
endif
ifndef OPTFLAGS
OPTFLAGS = -Winvalid-pch -DWINDOWS $(GFLAG)
endif
ifndef OBJDIR
OBJDIR = obj
endif
NAME = keeper
ROOT = ./
TOROOT = ./../
IPATH = -I. -I./extern -Iextern/steamworks/public
CFLAGS += $(IPATH)
ifdef STEAMWORKS
SRCS = $(shell ls -t *.cpp)
else
SRCS = $(shell ls -t *.cpp | grep -v steam_.*.cpp)
endif
ifdef UNITY
$(shell rm unity.cpp; for I in *.cpp; do echo \#include \"$$I\" | grep -v stack_printer | grep -v fontstash | grep -v file_sharing | grep -v theoraplay >> unity.cpp; done )
SRCS = unity.cpp file_sharing.cpp fontstash.cpp stack_printer.cpp theoraplay.cpp
endif
SRCS += $(shell ls -t extern/*.cpp)
ifdef AMD64
RES_FILE=keeper.res
else
RES_FILE=keeper32.res
endif
OPENAL = $(shell $(PKG_CONFIG) --libs openal)
LIBS = -mwindows ${RES_FILE} -lvorbisfile -lvorbis -logg -ltheoradec -lSDL2_image -lkernel32 -luser32 -lgdi32 -lcomdlg32 \
-lole32 -ldinput -lddraw -ldxguid -lwinmm -ldsound -lpsapi -lgdiplus -lshlwapi -luuid -ldbghelp $(STEAM_LIBS) \
-lSDL2 -lSDL2main -lglu32 -lz -ljpeg $(OPENAL) -lopengl32 -lcurl -limagehlp -lpthread -fuse-ld=lld
ifdef debug
CFLAGS += -g
OBJDIR := ${addsuffix -d,$(OBJDIR)}
NAME := ${addsuffix -d,$(NAME)}
else
CFLAGS += $(OPTFLAGS)
endif
OBJS = $(addprefix $(OBJDIR)/,$(SRCS:.cpp=.o))
DEPS = $(addprefix $(OBJDIR)/,$(SRCS:.cpp=.d))
##############################################################################
all:
@$(MAKE) -f Makefile-win --no-print-directory info
bash ./gen_version.sh
@$(MAKE) -f Makefile-win --no-print-directory compile
compile: gen_version $(NAME)
stdafx.h.gch: stdafx.h $(wildcard *.h)
$(GCC) -MMD $(CFLAGS) -c $< -o $@
ifndef RELEASE
PCH = $(OBJDIR)/stdafx.h.gch
PCHINC = -include stdafx.h
endif
$(OBJDIR)/%.o: %.cpp ${PCH}
$(GCC) -MMD $(CFLAGS) $(PCHINC) -c $< -o $@
$(NAME): $(OBJS)
$(LD) $(CFLAGS) -o $@ $^ $(LIBS)
gen_version:
bash ./gen_version.sh
info:
@$(GCC) -v 2>&1 | head -n 2
clean:
$(RM) $(OBJDIR)/*.o
$(RM) $(OBJDIR)/*.d
$(RM) $(NAME)
$(RM) stdafx.h.gch
$(RM) unity.cpp
-include $(DEPS)