-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakerules
98 lines (77 loc) · 2.23 KB
/
Makerules
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
APPNAME = VirtualGL
OS := $(shell uname -s)
ARCH := $(shell uname -m)
platform := windows
subplatform :=
ifeq ($(TOPDIR),)
TOPDIR = ..
endif
_DUMMY0 := $(shell if [ ! -f $(TOPDIR)/config ]; then touch $(TOPDIR)/config; fi)
include $(TOPDIR)/config
ifeq ($(M32), yes)
subplatform :=
endif
_DUMMY1 := $(shell if [ ! -f $(TOPDIR)/config.$(platform)$(subplatform) ]; then touch $(TOPDIR)/config.$(platform)$(subplatform); fi)
include $(TOPDIR)/config.$(platform)$(subplatform)
# Macros which are common to all Unix platforms
VERSION := 0.1
BUILD := $(shell date +%Y%m%d)
ifeq ($(DEBUG), yes)
BUILD := $(BUILD)d
endif
BLDDIR = $(TOPDIR)/$(platform)$(subplatform)
BLDDIR32 = $(TOPDIR)/$(platform)
ifeq ($(DEBUG), yes)
BLDDIR := $(BLDDIR)/dbg
BLDDIR32 := $(BLDDIR32)/dbg
endif
ENAME = bin
LNAME = lib
ifeq ($(ONAME),)
ONAME := obj
endif
EDIR := $(BLDDIR)/$(ENAME)
EDIR32 := $(BLDDIR32)/$(ENAME)
LDIR := $(BLDDIR)/$(LNAME)
LDIR32 := $(BLDDIR32)/$(LNAME)
ODIR := $(BLDDIR)/$(ONAME)
ODIR32 := $(BLDDIR32)/$(ONAME)
_DUMMY := $(shell mkdir -p $(EDIR))
_DUMMY2 := $(shell mkdir -p $(LDIR))
_DUMMY3 := $(shell mkdir -p $(ODIR))
RM = rm -f
INSTALL = install
# System-specific macros
include $(TOPDIR)/Makerules.$(platform)
CINCLUDES := $(CINCLUDES) -I$(TOPDIR)/$(platform)/include -I$(TOPDIR)/include -I.
CDEFINES := $(CDEFINES) -D__VERSION=\"$(VERSION)\" -D__BUILD=\"$(BUILD)\" -D__APPNAME=\"$(APPNAME)\"
ifeq ($(DEBUG), yes)
CDEFINES := $(CDEFINES) -D__DEBUG__
endif
ifeq ($(USEXV), yes)
CDEFINES := $(CDEFINES) -DUSEXV
endif
ifeq ($(CXXFLAGS),)
CXXFLAGS := $(CFLAGS)
endif
CFLAGS := $(CFLAGS) $(OPTFLAG) $(ARCHFLAG) $(CDEFINES) $(CINCLUDES)
CXXFLAGS := $(CXXFLAGS) $(OPTFLAG) $(ARCHFLAG) $(CDEFINES) $(CINCLUDES)
ifeq ($(platform), windows)
LDFLAGS := -LIBPATH:$(LDIR) $(LDFLAGS)
else
LDFLAGS := $(OPTFLAG) $(ARCHFLAG) -L$(LDIR) $(LDFLAGS)
endif
# Implicit rules
$(ODIR)/%.obj: %.c
$(CC) $(CFLAGS) -c $< -Fo$@
$(ODIR)/%.obj: %.cpp
$(CXX) $(CXXFLAGS) -c $< -Fo$@
$(ODIR)/%.obj: %.cxx
$(CXX) $(CXXFLAGS) -c $< -Fo$@
$(LDIR)/%.lib: $(ODIR)/%.obj
$(AR) -out:$@ $<
# This assures that the "clean" command runs even if there is a file called
# "clean" in the current directory
.PHONY : clean
include $(TOPDIR)/config
include $(TOPDIR)/config.$(platform)$(subplatform)