sgl
view Makefile.in @ 14:5b8fb89fe63f
cocoa...
author | John Tsiombikas <nuclear@siggraph.org> |
---|---|
date | Mon, 16 May 2011 23:09:53 +0300 |
parents | bf34fa677960 |
children | 12ce0cef7ebf |
line source
1 src = $(wildcard src/*.c)
2 msrc = $(wildcard src/*.m)
3 obj = $(src:.c=.o)
4 dep = $(src:.c=.d)
5 lib_a = libsgl.a
6 soname = libsgl.so.$(somajor)
7 lib_so = $(lib_so_$(sys))
9 somajor = 0
10 sominor = 0
12 lib_so_unix = $(soname).$(sominor)
13 lib_so_mac = libsgl.dylib
15 sharedopt_unix = -shared -Wl,-soname,$(soname)
16 sharedopt_mac = -dynamiclib
18 ifeq ($(shell uname -s), Darwin)
19 sys = mac
20 obj += $(msrc:.m=.o)
21 else
22 sys = unix
23 endif
25 AR = ar
26 CC = gcc
27 CFLAGS = -pedantic -Wall -g -fPIC -Iinclude -Isrc
28 LDFLAGS = $(wsys_libs)
30 .PHONY: all
31 all: $(lib_so) $(lib_a)
33 $(lib_a): $(obj)
34 $(AR) rcs $@ $(obj)
36 $(lib_so): $(obj)
37 $(CC) $(sharedopt_$(sys)) -o $@ $(obj) $(LDFLAGS)
39 -include $(dep)
41 %.d: %.c
42 @$(CPP) $(CFLAGS) -MM -MT $(@:.d=.o) $< >$@
44 .PHONY: clean
45 clean:
46 rm -f $(obj) $(dep) $(lib_so) $(lib_a)
48 .PHONY: install
49 install:
50 mkdir -p $(PREFIX)/include $(PREFIX)/lib
51 cp $(lib_a) $(PREFIX)/lib/$(lib_a)
52 cp $(lib_so) $(PREFIX)/lib/$(lib_so)
53 cp include/sgl.h $(PREFIX)/include/sgl.h
55 .PHONY: uninstall
56 uninstall:
57 rm -f $(PREFIX)/lib/$(lib_a)
58 rm -f $(PREFIX)/lib/$(lib_so)
59 rm -f $(PREFIX)/include/sgl.h