libpsys
view Makefile.in @ 20:0a53b22f7caf
the billboarding was wrong ...
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Tue, 18 Sep 2012 09:38:48 +0300 |
parents | 0f83e882fd04 |
children |
line source
1 src = $(wildcard src/*.c)
2 obj = $(src:.c=.o)
3 dep = $(obj:.o=.d)
4 lib_a = libpsys.a
5 hdr = $(wildcard src/*.h)
7 ifeq ($(shell uname -s), Darwin)
8 lib_so = libpsys.dylib
9 shared = -dynamiclib
10 libgl = -framework OpenGL
11 else
12 somajor = 0
13 sominor = 1
14 soname = libpsys.so.$(somajor)
15 lib_so = $(soname).$(sominor)
16 devlink = libpsys.so
17 shared = -shared -Wl,-soname,$(soname)
18 libgl = -lGL
19 endif
22 CC = gcc
23 AR = ar
24 CFLAGS = -std=c89 -pedantic -Wall $(dbg) $(opt) -fPIC -Isrc
25 LDFLAGS = -lanim -limago -lvmath $(libgl)
27 .PHONY: all
28 all: $(lib_a) $(lib_so)
30 $(lib_a): $(obj)
31 $(AR) rcs $@ $(obj)
33 $(lib_so): $(obj)
34 $(CC) $(shared) -o $@ $(obj) $(LDFLAGS)
36 -include $(dep)
38 %.d: %.c
39 @$(CPP) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@
42 .PHONY: install
43 install: $(lib_a) $(lib_so)
44 mkdir -p $(DESTDIR)$(PREFIX)/include/psys
45 cp $(hdr) $(DESTDIR)$(PREFIX)/include/psys/
46 cp $(lib_a) $(DESTDIR)$(PREFIX)/lib/$(lib_a)
47 cp $(lib_so) $(DESTDIR)$(PREFIX)/lib/$(lib_so)
48 [ -n "$(soname)" ] \
49 && cd $(DESTDIR)$(PREFIX)/lib \
50 && rm -f $(soname) $(devlink) \
51 && ln -s $(lib_so) $(soname) \
52 && ln -s $(soname) $(devlink) \
53 || true
55 .PHONY: uninstall
56 uninstall:
57 rm -f $(DESTDIR)$(PREFIX)/include/psys/*.h
58 rmdir $(DESTDIR)$(PREFIX)/include/psys
59 rm -f $(DESTDIR)$(PREFIX)/lib/$(lib_a)
60 rm -f $(DESTDIR)$(PREFIX)/lib/$(lib_so)
61 [ -n "$(soname)" ] \
62 && cd $(DESTDIR)$(PREFIX)/lib \
63 && rm -f $(soname) $(devlink) \
64 || true
66 .PHONY: clean
67 clean:
68 rm -f $(obj) $(lib_so) $(lib_a)