-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
94 lines (82 loc) · 2.54 KB
/
Makefile
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
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# File: glem/Makefile
# Created: 07-May-2016
# Author: Siddharth Chandrasekaran <[email protected]>
CC_FLAGS += -Wall -O3
INCLUDE_PATH += -Iinclude
LIB_PATH += -Llib
ifeq ($(OS),Windows_NT)
ifeq ($(PROCESSOR_ARCHITEW6432),AMD64)
CCFLAGS += -D AMD64
else
ifeq ($(PROCESSOR_ARCHITECTURE),AMD64)
CCFLAGS += -D AMD64
endif
ifeq ($(PROCESSOR_ARCHITECTURE),x86)
CCFLAGS += -D IA32
endif
endif
CCFLAGS += -D WIN32
LDFLAGS += -Wl,--subsystem,windows
INCLUDE_PATH += -I"C:\Program Files\freeglut\include"
LIB_PATH += -L"C:\Program Files\freeglut\lib\x64"
LIBS := -lfreeglut -lopengl32
GLEM_BIN := Glem.exe
EXAMPLE_BIN := Example.exe
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
CCFLAGS += -D LINUX
endif
ifeq ($(UNAME_S),Darwin)
CCFLAGS += -D OSX
endif
UNAME_P := $(shell uname -p)
ifeq ($(UNAME_P),x86_64)
CCFLAGS += -D AMD64
endif
ifneq ($(filter %86,$(UNAME_P)),)
CCFLAGS += -D IA32
endif
ifneq ($(filter arm%,$(UNAME_P)),)
CCFLAGS += -D ARM
endif
LIBS := -lGL -lGLU -lglut
GLEM_BIN := glem
EXAMPLE_BIN := example
endif
CC := gcc
LIBS += -lglem -pthread
all: dirs lib/libglem.a glem examples
glem: obj/glem.o
@echo "Building glem server"
@$(CC) $(LDFLAGS) -o $(GLEM_BIN) $^ $(LIB_PATH) $(LIBS)
lib/libglem.a: obj/libglem.o
@echo "Building libglem.a"
@ar rcs lib/libglem.a obj/libglem.o
examples:
@make -s -C examples all
manpages:
@echo "Regenerating man pages from markdown"
@ronn -r doc/glem.ronn doc/lib-glem.ronn
obj/%.o: src/%.c
@echo "Compiling $<"
@$(CC) $(CCFLAGS) -o "$@" -c "$<" $(INCLUDE_PATH)
dirs:
@mkdir -p obj lib
clean:
@make -s -C examples clean
@rm -rf obj/ lib/ $(GLEM_BIN)
.PHONY: clean glem dirs manpages examples