-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile.unix
64 lines (49 loc) · 1.13 KB
/
Makefile.unix
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
SYS:=$(shell uname)
CXX:=g++
CXXFLAGS:=-g -O3 -Wall -Wextra -std=c++11
ifeq ($(USER),neumann)
CXXFLAGS:=$(CXXFLAGS) -Werror
endif
CXXFLAGS-gtest:=-Wno-missing-field-initializers
IFLAGS:=-Iinclude
IFLAGS-gtest:=-Igtest/include -Igtest
IFLAGS-test:=-Igtest/include
OBJEXT:=.o
EXEEXT:=
TARGET:=-o
EXETARGET:=-o
nativefile=$(1)
define checkdir
@mkdir -p $(dir $@)
endef
ifeq ($(CXX),icc)
CXXFLAGS:=-g -O3
LIBS:=-lstdc++ -lpthread
FORCELIBS:=1
endif
ifeq ($(LINEEDITOR),)
ifeq ($(wildcard lineeditor/LineEditor.cpp),lineeditor/LineEditor.cpp)
LINEEDITOR:=1
endif
endif
ifeq ($(LINEEDITOR),1)
CXXFLAGS:=$(CXXFLAGS) -DCONFIG_LINEEDITOR
endif
ifeq ($(FORCELIBS),)
LIBS:=-lpthread
ifeq ($(SYS),SunOS)
LIBS:=$(LIBS) -lsocket -lnsl
endif
ifeq ($(SYS),Darwin)
CXXFLAGS:=$(CXXFLAGS) -DCONFIG_DARWIN -Wno-error -m64
endif
ifneq ($(SYS),Darwin)
LIBS:=$(LIBS) -lrt
endif
ifeq ($(LINEEDITOR),1)
LIBFILE-termcap:=-ltermcap
endif
endif
define buildexe
$(CXX) $(EXETARGET)$@ $(CXXFLAGS) $(CXXFLAGS-$(subst $(PREFIX),,$(basename $@))) $(IFLAGS) $(filter %$(OBJEXT),$^) $(foreach file,$(LIBS-$(patsubst $(PREFIX)%$(EXEEXT),%,$@)),$(LIBFILE-$(file))) $(LIBS)
endef