-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile.nt
53 lines (46 loc) · 1.08 KB
/
Makefile.nt
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
# Hack, GNU make suggests g++ by default
ifeq ($(origin CXX), default)
CXX:=
endif
ifeq ($(CXX),)
CXX:=g++
endif
ifeq ($(CXX),bcc32)
CXXFLAGS:=-v -vi -y -R -O2 -tWM -w
IFLAGS:=-Iinclude
OBJEXT:=.obj
EXEEXT:=.exe
TARGET:=-o
EXETARGET:=-e
endif
ifeq ($(CXX),cl)
CXXFLAGS:=/O2 /Zi /Zc:forScope /GR /EHsc /MT
IFLAGS:=/Iinclude
OBJEXT:=.obj
EXEEXT:=.exe
TARGET:=/Fo
EXETARGET:=/Fe
LIBS:=wsock32.lib
endif
ifeq ($(CXX),g++)
CXXFLAGS:=-g -O0 -W -Wall
ifeq ($(USER),neumann)
CXXFLAGS:=$(CXXFLAGS) -Werror
endif
CXXFLAGS-gtest:=-Wno-error -DGTEST_OS_WINDOWS
IFLAGS:=-Iinclude
IFLAGS-gtest:=-Igtest/include -Igtest
IFLAGS-test:=-Igtest/include
OBJEXT:=.o
EXEEXT:=.exe
TARGET:=-o
EXETARGET:=-o
LIBS:=-lws2_32
endif
nativefile=$(subst /,\\,$(1))
define checkdir
@if not exist $(call nativefile,$(dir $@)) mkdir $(call nativefile,$(dir $@))
endef
define buildexe
$(CXX) $(EXETARGET)$(call nativefile,$@) $(CXXFLAGS) $(CXXFLAGS-$(subst $(PREFIX),,$(basename $@))) $(IFLAGS) $(call nativefile,$(filter %$(OBJEXT),$^)) $(foreach file,$(LIBS-$(patsubst $(PREFIX)%$(EXEEXT),%,$@)),$(LIBFILE-$(file))) $(LIBS)
endef