-
Notifications
You must be signed in to change notification settings - Fork 75
/
Makedefs.Win32
76 lines (56 loc) · 1.8 KB
/
Makedefs.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
PATHS = /usr/bin/i686-pc-mingw32- /usr/bin/i686-w64-mingw32-
CC := $(or $(firstword $(realpath $(foreach path,$(PATHS),$(path)gcc))), $(error Couldn't find gcc))
CXX := $(or $(firstword $(realpath $(foreach path,$(PATHS),$(path)g++))), $(error Couldn't find g++))
AR := $(or $(firstword $(realpath $(foreach path,$(PATHS),$(path)ar))), $(error Couldn't find ar))
WINDRES := $(or $(firstword $(realpath $(foreach path,$(PATHS),$(path)windres))), $(error Couldn't find windres))
EXE = .exe
ARCHOPTS = -m32 -march=core2 -mfpmath=sse -mtune=native
COPTS = -fno-strict-overflow -fno-math-errno -fno-trapping-math
COPTS += -Wall -Wextra -Wshadow
DEFINES = -U_FORTIFY_SOURCE
LDOPTS = -static-libgcc -static-libstdc++
ifdef DEBUG
COPTS += -O1 -ggdb3 -fno-omit-frame-pointer
DEFINES += -DDEBUG
else
COPTS += -O3 -fomit-frame-pointer
# Workaround for g++ 4.5.2
COPTS += -fno-caller-saves -fno-gcse
# No commandline window
#COPTS += -mwindows
DEFINES += -DNDEBUG
LDOPTS += -s
endif
OPENMPOPTS = -fopenmp
CXXOPTS = $(COPTS)
CFLAGS = $(ARCHOPTS) $(OPENMPOPTS) $(INCLUDES) $(DEFINES) $(COPTS)
CXXFLAGS = $(ARCHOPTS) $(OPENMPOPTS) $(INCLUDES) $(DEFINES) $(CXXOPTS)
LDFLAGS = $(LIBDIR) $(LDOPTS)
LIBS = -lm
GLLIBS = -lgluit -lwinmm -lglu32 -lopengl32 -lgdi32
$(OBJDIR)/%.o: %.c
@ echo "Compiling $<"
@ rm -f $@
@ $(CC) $(CFLAGS) -MMD -MP -c $< -o $@
$(OBJDIR)/%.o: %.cc
@ echo "Compiling $<"
@ rm -f $@
@ $(CXX) $(CXXFLAGS) -MMD -MP -c $< -o $@
$(OBJDIR)/%.o: %.cpp
@ echo "Compiling $<"
@ rm -f $@
@ $(CXX) $(CXXFLAGS) -MMD -MP -c $< -o $@
ifneq (,$(findstring -L,$(LIBDIR)))
VPATH = $(subst -L,,$(LIBDIR))
endif
define LINK
@ echo "Linking $@"
@ rm -f $@
@ $(CXX) $(CXXFLAGS) $^ $(LDFLAGS) $(LIBS) -o $@
endef
define STATICLIB
@ echo "Creating library $@"
@ rm -f $@
@ $(AR) -rcs $@ $^
endef
-include $(OBJDIR)/*.d