-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
113 lines (73 loc) · 2.19 KB
/
Makefile
File metadata and controls
113 lines (73 loc) · 2.19 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
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# the name of the compiled binary
TARGET := morph
# list files to compile and link together
FILES := morph parseConfig
#################################################################
# The following Makefile rules should work for Linux or Cygwin
CC := g++
LD := g++
OBJSUFFIX := .o
LIBPREFIX := lib
STATIC_LIBSUFFIX := .a
LDFLAGS :=
FRAMEWORKS :=
LIBS := st png jpeg
# Decide compiler flags based on debug/release mode
ifeq ($(RELEASE), 1)
CFLAGS := -O2
else
CFLAGS := -g
endif
ARCH=$(shell uname | sed -e 's/-.*//g')
ifeq ($(ARCH), CYGWIN_NT)
# if we're building in cygwin, we'll need to use the
# win32 versions of gl and glut
EXESUFFIX := .exe
LIBS += glut32 opengl32
else
ifeq ($(ARCH),Darwin)
# we're building on the mac
EXESUFFIX :=
FRAMEWORKS += OpenGL GLUT
#
# mac users need to point to the libjpeg include directories
#
EXTRA_INC_DIRS := /opt/local/include glew/include
EXTRA_LIB_DIRS := /opt/local/lib
else
# building on Linux
EXESUFFIX :=
LIBS += GL GLU glut
#
# hack for myth machines. Add /usr/lib as an explicit lib dir so
# it gets picked up instead of /usr/pubsw/lib.
#
EXTRA_LIB_DIRS := /usr/lib64 /usr/lib
EXTRA_INC_DIRS := /usr/include/freetype2 glew/include
endif
endif
LIBST := st
LIBST_ROOT := ../libst
LIBST_DIR := $(LIBST_ROOT)/lib
LIBST_INC := $(LIBST_ROOT)/include
TARGET := $(addsuffix $(EXESUFFIX), $(TARGET))
INCDIRS := . $(LIBST_INC) $(EXTRA_INC_DIRS)
LIBDIRS := $(LIBST_DIR) $(EXTRA_LIB_DIRS)
CFLAGS += $(addprefix -I, $(INCDIRS))
LDFLAGS += $(addprefix -L, $(LIBDIRS))
LDLIBS := $(addprefix -l, $(LIBS))
LDFRAMEWORKS := $(addprefix -framework , $(FRAMEWORKS))
OBJS := $(addsuffix $(OBJSUFFIX), $(FILES))
.SUFFIXES : .cpp $(OBJSUFFIX)
.PHONY : clean release all
all: $(TARGET)
../libst/lib/libst.a:
(cd ../libst; make)
$(TARGET): $(OBJS) ../libst/lib/libst.a
$(LD) -o $(TARGET) $(OBJS) $(LDFLAGS) $(LDLIBS) $(LDFRAMEWORKS)
%.o : %.cpp
$(CC) $(CFLAGS) -o $@ -c $<
clean:
rm -rf *$(OBJSUFFIX) $(TARGET) *~ .#*
release:
@make --no-print-directory RELEASE=1