-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathrules.mk
More file actions
70 lines (56 loc) · 1.38 KB
/
rules.mk
File metadata and controls
70 lines (56 loc) · 1.38 KB
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
# Quiet
#Q ?= @
RANLIB ?= ranlib
HOSTOS := $(shell uname -s)
ifeq ($(PLATFORM),)
PLATFORM := $(HOSTOS)
endif
ifeq ($(RELEASE),)
DEBUG = 1
CPPFLAGS += -D_DEBUG
else
CPPFLAGS += -DNDEBUG
endif
MATH_LIBS ?= -lm
ifeq ($(PLATFORM),win32)
EXE = .exe
.SUFFIXES: .exe
CROSS_COMPILE ?= i586-mingw32msvc-
CC := $(CROSS_COMPILE)$(CC)
CXX := $(CROSS_COMPILE)$(CXX)
AR := $(CROSS_COMPILE)$(AR)
RANLIB := $(CROSS_COMPILE)$(RANLIB)
WINDRES := $(CROSS_COMPILE)windres
CPPFLAGS += -DWIN32
# add default rules for exe files
%.exe: %.o
$(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@
%.exe: %.c
$(LINK.c) $^ $(LOADLIBES) $(LDLIBS) -o $@
endif
ifeq ($(PLATFORM),Haiku)
CURSES_LIB := -lncurses
MATH_LIBS :=
endif
ifneq ($(PLATFORM),win32)
CURSES_LIB ?= -lcurses
STDCXX_LIB ?= -lstdc++
COMMON_EXTRA_LDFLAGS += $(CURSES_LIB) $(STDCXX_LIB)
CXXSTD ?= -std=c++11
CXXFLAGS += $(CXXSTD)
CPPFLAGS += -D__cdecl= -DPOSIX
CFLAGS += -Wall
endif
ifneq ($(OSDK),)
#FIXME: This is a HACK to avoid install being the default target.
# TODO: move the include to bottom of makefiles
ifeq ($(MAKECMDGOALS),install)
#$(info OSDK=$(OSDK))
#ifneq ($(BINS),)
#$(info BINS=$(BINS))
install:
$(Q)install -d $(OSDK)/bin
$(Q)for B in $(BINS) $(EXECUTABLE); do install $$B $(OSDK)/bin/; done
$(Q)for B in $(BINS) $(EXECUTABLE); do b="`echo "$$B" | tr A-Z a-z`"; if [ "$$B" != "$$b" ]; then ln -sf "$$B" "$(OSDK)/bin/$$b"; fi; done
endif
endif