-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.myth
114 lines (74 loc) · 2.22 KB
/
Makefile.myth
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
# the name of the compiled binary
TARGET := ProgrammableShading
# list files to compile and link together
FILES := main
#################################################################
# The following Makefile rules should work for Linux or Cygwin
CC := g++
LD := g++
OBJSUFFIX := .o
LIBPREFIX := lib
STATIC_LIBSUFFIX := .a
CFLAGS := -g
CFLAGS_PLATFORM :=
LDFLAGS :=
FRAMEWORKS :=
LIBS := st png jpeg freetype
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
CFLAGS_PLATFORM += `freetype-config --cflags`
else
ifeq ($(ARCH),Darwin)
# we're building on the mac
EXESUFFIX :=
FRAMEWORKS += OpenGL GLUT AppKit IOKit
CFLAGS_PLATFORM += `freetype-config --cflags`
#
# Mac users need to point to the libjpeg and libpng directories as well as the
# freetype headers.
#
# The default location of a fink install is given below.
#
EXTRA_LIB_DIRS := /sw/lib /opt/local/lib
EXTRA_INC_DIRS := /sw/include /opt/local/include glew/include
else
# building on Linux
EXESUFFIX :=
LIBS += glut GL GLEW
CFLAGS_PLATFORM += `freetype-config --cflags`
#
# 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/lib glew/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))
CFLAGS += $(CFLAGS_PLATFORM)
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)
$(TARGET): $(OBJS)
$(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