-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathMakefile
67 lines (54 loc) · 1.51 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
PREFIX = /usr/local
olib = miniglut.o
otest = test.o
alib = libminiglut.a
bin = test
CFLAGS = -pedantic -Wall -g
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)
olib = miniglut.w32.o
otest = test.w32.o
alib = libminiglut-w32.a
bin = test.exe
# on windows/mingw we can build without linking to libc
CFLAGS += -DMINIGLUT_NO_LIBC
LDFLAGS = -mconsole -lopengl32 -lgdi32 -lwinmm
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
ifeq ($(sys), IRIX)
CC = gcc
endif
endif
endif
$(bin): $(otest) $(alib)
$(CC) -o $@ $(otest) $(alib) $(LDFLAGS)
$(alib): $(olib)
$(AR) rcs $@ $(olib)
%.w32.o: %.c
$(CC) -o $@ $(CFLAGS) -c $<
.PHONY: clean
clean:
rm -f $(alib) $(olib) $(otest) $(bin)
.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