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