-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathGNUmakefile
More file actions
67 lines (52 loc) · 1.54 KB
/
GNUmakefile
File metadata and controls
67 lines (52 loc) · 1.54 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
PREFIX = /usr/local
olib = miniglut.o
alib = libminiglut.a
bin_3dview = 3dview
bin_vsync = vsync
CFLAGS = -O3 -g3
isx86 ?= $(shell uname -m | sed 's/x86_64/x86/; s/i.86/x86/')
sys ?= $(shell uname -s | sed 's/MINGW.*/mingw/; s/IRIX.*/IRIX/')
ifeq ($(sys), mingw)
# on windows/mingw we can build without linking to libc
CFLAGS += -DMINIGLUT_NO_LIBC
LDFLAGS = -mconsole -lopengl32 -lgdi32 -lwinmm
bin_3dview = 3dview.exe
bin_vsync = vsync.exe
else
ifeq ($(sys)-$(isx86), Linux-x86)
# for Linux x86/x86-64 we can build without linking to libc
CFLAGS += -I/usr/X11R6/include -DMINIGLUT_NO_LIBC
LDFLAGS = -L/usr/X11R6/lib -lX11 -lGL
else
# for other UNIX or non-x86 where sys_ and trig functions are not
# implemented, just use libc
LDFLAGS = -lX11 -lGL -lm
endif
endif
tests = $(bin_3dview) $(bin_vsync)
.PHONY: all
all: $(alib) $(tests)
$(bin_3dview): tests/3dview.o $(alib)
$(CC) -o $@ $< $(alib) $(LDFLAGS)
$(bin_vsync): tests/vsync.o $(alib)
$(CC) -o $@ $< $(alib) $(LDFLAGS)
$(alib): $(olib)
$(AR) rcs $@ $(olib)
.PHONY: clean
clean:
rm -f $(alib) $(olib) $(tests) tests/*.o
.PHONY: install
install: $(alib)
mkdir -p $(DESTDIR)$(PREFIX)/include $(DESTDIR)$(PREFIX)/lib
cp miniglut.h $(DESTDIR)$(PREFIX)/include/miniglut.h
cp $(alib) $(DESTDIR)$(PREFIX)/lib/libminiglut.a
.PHONY: uninstall
uninstall:
rm -f $(DESTDIR)$(PREFIX)/include/miniglut.h
rm -f $(DESTDIR)$(PREFIX)/lib/libminiglut.a
.PHONY: cross
cross:
$(MAKE) CC=i686-w64-mingw32-gcc sys=mingw
.PHONY: cross-clean
cross-clean:
$(MAKE) CC=i686-w64-mingw32-gcc sys=mingw clean