libpsys

annotate 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
rev   line source
nuclear@0 1 src = $(wildcard src/*.c)
nuclear@0 2 obj = $(src:.c=.o)
nuclear@7 3 dep = $(obj:.o=.d)
nuclear@0 4 lib_a = libpsys.a
nuclear@10 5 hdr = $(wildcard src/*.h)
nuclear@7 6
nuclear@7 7 ifeq ($(shell uname -s), Darwin)
nuclear@12 8 lib_so = libpsys.dylib
nuclear@7 9 shared = -dynamiclib
nuclear@12 10 libgl = -framework OpenGL
nuclear@7 11 else
nuclear@7 12 somajor = 0
nuclear@7 13 sominor = 1
nuclear@7 14 soname = libpsys.so.$(somajor)
nuclear@7 15 lib_so = $(soname).$(sominor)
nuclear@10 16 devlink = libpsys.so
nuclear@7 17 shared = -shared -Wl,-soname,$(soname)
nuclear@12 18 libgl = -lGL
nuclear@7 19 endif
nuclear@7 20
nuclear@0 21
nuclear@0 22 CC = gcc
nuclear@7 23 AR = ar
nuclear@9 24 CFLAGS = -std=c89 -pedantic -Wall $(dbg) $(opt) -fPIC -Isrc
nuclear@12 25 LDFLAGS = -lanim -limago -lvmath $(libgl)
nuclear@0 26
nuclear@0 27 .PHONY: all
nuclear@0 28 all: $(lib_a) $(lib_so)
nuclear@0 29
nuclear@0 30 $(lib_a): $(obj)
nuclear@7 31 $(AR) rcs $@ $(obj)
nuclear@0 32
nuclear@0 33 $(lib_so): $(obj)
nuclear@7 34 $(CC) $(shared) -o $@ $(obj) $(LDFLAGS)
nuclear@7 35
nuclear@7 36 -include $(dep)
nuclear@7 37
nuclear@7 38 %.d: %.c
nuclear@7 39 @$(CPP) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@
nuclear@7 40
nuclear@0 41
nuclear@0 42 .PHONY: install
nuclear@0 43 install: $(lib_a) $(lib_so)
nuclear@10 44 mkdir -p $(DESTDIR)$(PREFIX)/include/psys
nuclear@10 45 cp $(hdr) $(DESTDIR)$(PREFIX)/include/psys/
nuclear@10 46 cp $(lib_a) $(DESTDIR)$(PREFIX)/lib/$(lib_a)
nuclear@10 47 cp $(lib_so) $(DESTDIR)$(PREFIX)/lib/$(lib_so)
nuclear@10 48 [ -n "$(soname)" ] \
nuclear@10 49 && cd $(DESTDIR)$(PREFIX)/lib \
nuclear@10 50 && rm -f $(soname) $(devlink) \
nuclear@10 51 && ln -s $(lib_so) $(soname) \
nuclear@10 52 && ln -s $(soname) $(devlink) \
nuclear@10 53 || true
nuclear@0 54
nuclear@0 55 .PHONY: uninstall
nuclear@0 56 uninstall:
nuclear@12 57 rm -f $(DESTDIR)$(PREFIX)/include/psys/*.h
nuclear@12 58 rmdir $(DESTDIR)$(PREFIX)/include/psys
nuclear@12 59 rm -f $(DESTDIR)$(PREFIX)/lib/$(lib_a)
nuclear@12 60 rm -f $(DESTDIR)$(PREFIX)/lib/$(lib_so)
nuclear@12 61 [ -n "$(soname)" ] \
nuclear@12 62 && cd $(DESTDIR)$(PREFIX)/lib \
nuclear@12 63 && rm -f $(soname) $(devlink) \
nuclear@12 64 || true
nuclear@0 65
nuclear@0 66 .PHONY: clean
nuclear@0 67 clean:
nuclear@7 68 rm -f $(obj) $(lib_so) $(lib_a)