sgl

view Makefile.in @ 10:1532e43bf858

- added mac-framework: -framework GLUT in wsys_glut.c
author John Tsiombikas <nuclear@siggraph.org>
date Sat, 14 May 2011 08:59:37 +0300
parents 0570e27e5ebc
children bf34fa677960
line source
1 src = $(wildcard src/*.c)
2 obj = $(src:.c=.o)
3 dep = $(src:.c=.d)
4 lib_a = libsgl.a
5 soname = libsgl.so.$(somajor)
6 lib_so = $(lib_so_$(sys))
8 somajor = 0
9 sominor = 0
11 lib_so_unix = $(soname).$(sominor)
12 lib_so_mac = libsgl.dylib
14 sharedopt_unix = -shared -Wl,-soname,$(soname)
15 sharedopt_mac = -dynamiclib
17 ifeq ($(shell uname -a), Darwin)
18 sys = mac
19 else
20 sys = unix
21 endif
23 AR = ar
24 CC = gcc
25 CFLAGS = -pedantic -Wall -g -fPIC -Iinclude -Isrc
26 LDFLAGS = $(wsys_libs)
28 .PHONY: all
29 all: $(lib_so) $(lib_a)
31 $(lib_a): $(obj)
32 $(AR) rcs $@ $(obj)
34 $(lib_so): $(obj)
35 $(CC) $(sharedopt_$(sys)) -o $@ $(obj) $(LDFLAGS)
37 -include $(dep)
39 %.d: %.c
40 @$(CPP) $(CFLAGS) -MM -MT $(@:.d=.o) $< >$@
42 .PHONY: clean
43 clean:
44 rm -f $(obj) $(dep) $(lib_so) $(lib_a)
46 .PHONY: install
47 install:
48 mkdir -p $(PREFIX)/include $(PREFIX)/lib
49 cp $(lib_a) $(PREFIX)/lib/$(lib_a)
50 cp $(lib_so) $(PREFIX)/lib/$(lib_so)
51 cp include/sgl.h $(PREFIX)/include/sgl.h
53 .PHONY: uninstall
54 uninstall:
55 rm -f $(PREFIX)/lib/$(lib_a)
56 rm -f $(PREFIX)/lib/$(lib_so)
57 rm -f $(PREFIX)/include/sgl.h