-
Notifications
You must be signed in to change notification settings - Fork 2
/
makefile.win32
77 lines (64 loc) · 2.87 KB
/
makefile.win32
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
CXX ?= i686-w64-mingw32-gcc
# path #
SRC_PATH = Pongbot
BUILD_PATH = build.win
BIN_PATH = $(BUILD_PATH)/bin
# executable #
BIN_NAME = Pongbot.dll
# extensions #
SRC_EXT = cpp
# code lists #
# Find all source files in the source directory, sorted by
# most recently modified
SOURCES = $(shell find $(SRC_PATH) -name '*.$(SRC_EXT)' | sort -k 1nr | cut -f2-)
# Set the object file names, with the source directory stripped
# from the path, and the build path prepended in its place
OBJECTS = $(SOURCES:$(SRC_PATH)/%.$(SRC_EXT)=$(BUILD_PATH)/%.o)
# Set the dependency files that will be used to add header dependencies
DEPS = $(OBJECTS:.o=.d)
# flags #
COMPILE_FLAGS = -Wall -Wextra -fpermissive -w -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp \
-Dstrnicmp=strncasecmp -D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca \
-Dstrcmpi=strcasecmp -Wall -Wno-non-virtual-dtor -Wno-overloaded-virtual \
-Werror -fPIC -fno-exceptions -msse -m32 -fno-strict-aliasing -D_WIN32 -shared -ggdb -nostdinc -D_DEBUG
# -fno-rtti
INCLUDES = -I $(MLIBS) -I $(MLIBS)/hlsdk $(addprefix -I,$(shell find $(MLIBS)/hlsdk/public -type d -print)) -I $(MLIBS)/hlsdk/engine \
-I $(MLIBS)/hlsdk/mathlib -I $(MLIBS)/hlsdk/vstdlib -I $(MLIBS)/hlsdk/game -I $(MLIBS)/hlsdk/game/tier1 -I $(MLIBS)/hlsdk/game/tier0 \
-I $(MLIBS)/hlsdk/tier0 -I $(MLIBS)/hlsdk/tier1 -I $(MLIBS)/hlsdk/game/server -I $(MLIBS)/hlsdk/game/shared -I $(MLIBS)/metamod \
-I $(MLIBS)/metamod/sourcehook -I /usr/i686-w64-mingw32/include -I /usr/i686-w64-mingw32/include/c++/9.2.0 \
-I /usr/i686-w64-mingw32/include/c++/9.2.0/i686-w64-mingw32 -I /usr/lib/gcc/i686-w64-mingw32/9.2.0/include \
-I /usr/i686-w64-mingw32/include/c++/9.2.0/tr1 -I Pongbot
# Space-separated pkg-config libraries used by this project
LIBS = -L$(MLIBS)/hlsdk/lib/public -l:tier0.lib -l:vstdlib.lib -l:mathlib.lib -l:tier1.lib -l:tier2.lib -l:tier3.lib -ldl
.PHONY: default_target
default_target: release
.PHONY: release
release: export CXXFLAGS := $(CXXFLAGS) $(COMPILE_FLAGS)
release: dirs
@$(MAKE) -f makefile.win32 win32
.PHONY: dirs
dirs:
@echo "Creating directories"
@mkdir -p $(dir $(OBJECTS))
@mkdir -p $(BIN_PATH)
.PHONY: clean
clean:
@echo "Deleting $(BIN_NAME) symlink"
@$(RM) $(BIN_NAME)
@echo "Deleting directories"
@$(RM) -r $(BUILD_PATH)
@$(RM) -r $(BIN_PATH)
# Creation of the executable
.PHONY: win32
win32: $(BIN_PATH)/$(BIN_NAME)
$(BIN_PATH)/$(BIN_NAME): $(OBJECTS)
@echo "Linking: $@"
$(CXX) $(CXXFLAGS) $(OBJECTS) $(LIBS) -o $@
# Add dependency files, if they exist
-include $(DEPS)
# Source file rules
# After the first compilation they will be joined with the rules from the
# dependency files to provide header dependencies
$(BUILD_PATH)/%.o: $(SRC_PATH)/%.$(SRC_EXT)
@echo "Compiling: $< -> $@"
$(CXX) $(CXXFLAGS) $(INCLUDES) $(LIBS) -MP -MMD -c $< -o $@