libpsys
view Makefile.in @ 11:23d4c50616ff
C++ header file compatibility
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Wed, 29 Aug 2012 05:10:46 +0300 |
parents | 9c24273f211b |
children | 55a2aa4443f7 |
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 = psys.dylib
9 shared = -dynamiclib
10 else
11 somajor = 0
12 sominor = 1
13 soname = libpsys.so.$(somajor)
14 lib_so = $(soname).$(sominor)
15 devlink = libpsys.so
16 shared = -shared -Wl,-soname,$(soname)
17 endif
20 CC = gcc
21 AR = ar
22 CFLAGS = -std=c89 -pedantic -Wall $(dbg) $(opt) -fPIC -Isrc
23 LDFLAGS = -lanim -limago -lvmath
25 .PHONY: all
26 all: $(lib_a) $(lib_so)
28 $(lib_a): $(obj)
29 $(AR) rcs $@ $(obj)
31 $(lib_so): $(obj)
32 $(CC) $(shared) -o $@ $(obj) $(LDFLAGS)
34 -include $(dep)
36 %.d: %.c
37 @$(CPP) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@
40 .PHONY: install
41 install: $(lib_a) $(lib_so)
42 mkdir -p $(DESTDIR)$(PREFIX)/include/psys
43 cp $(hdr) $(DESTDIR)$(PREFIX)/include/psys/
44 cp $(lib_a) $(DESTDIR)$(PREFIX)/lib/$(lib_a)
45 cp $(lib_so) $(DESTDIR)$(PREFIX)/lib/$(lib_so)
46 [ -n "$(soname)" ] \
47 && cd $(DESTDIR)$(PREFIX)/lib \
48 && rm -f $(soname) $(devlink) \
49 && ln -s $(lib_so) $(soname) \
50 && ln -s $(soname) $(devlink) \
51 || true
53 .PHONY: uninstall
54 uninstall:
55 @echo TODO
57 .PHONY: clean
58 clean:
59 rm -f $(obj) $(lib_so) $(lib_a)