libanim

diff Makefile.in @ 0:fad4701f484e

libanim mercurial repo
author John Tsiombikas <nuclear@mutantstargoat.com>
date Sun, 08 Jan 2012 05:13:13 +0200
parents
children f12663c5c907
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/Makefile.in	Sun Jan 08 05:13:13 2012 +0200
     1.3 @@ -0,0 +1,63 @@
     1.4 +src = $(wildcard src/*.c)
     1.5 +hdr = src/track.h src/anim.h src/config.h
     1.6 +obj = $(src:.c=.o)
     1.7 +dep = $(obj:.o=.d)
     1.8 +lib_a = libanim.a
     1.9 +
    1.10 +ifeq ($(shell uname -s), Darwin)
    1.11 +	lib_so = anim.dylib
    1.12 +	shared = -dynamiclib
    1.13 +else
    1.14 +	somajor = 0
    1.15 +	sominor = 1
    1.16 +	soname = libanim.so.$(somajor)
    1.17 +	lib_so = $(soname).$(sominor)
    1.18 +	solink = libanim.so
    1.19 +	shared = -shared -Wl,-soname,$(soname)
    1.20 +endif
    1.21 +
    1.22 +
    1.23 +CC = gcc
    1.24 +AR = ar
    1.25 +CFLAGS = $(opt) $(dbg) -pedantic -Wall -fPIC -I$(PREFIX)/include
    1.26 +LDFLAGS = -L$(PREFIX)/lib -lvmath -lm -lpthread
    1.27 +
    1.28 +.PHONY: all
    1.29 +all: $(lib_a) $(lib_so)
    1.30 +
    1.31 +$(lib_a): $(obj)
    1.32 +	$(AR) rcs $@ $(obj)
    1.33 +
    1.34 +$(lib_so): $(obj)
    1.35 +	$(CC) $(shared) -o $@ $(obj) $(LDFLAGS)
    1.36 +
    1.37 +-include $(dep)
    1.38 +
    1.39 +%.d: %.c
    1.40 +	@$(CPP) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@
    1.41 +
    1.42 +.PHONY: install
    1.43 +install: $(lib_a) $(lib_so)
    1.44 +	mkdir -p $(PREFIX)/lib $(PREFIX)/include/anim
    1.45 +	cp $(lib_a) $(PREFIX)/lib/$(lib_a)
    1.46 +	cp $(lib_so) $(PREFIX)/lib/$(lib_so)
    1.47 +	[ -n "$(solink)" ] && rm -f $(PREFIX)/lib/$(soname) $(PREFIX)/lib/$(solink) \
    1.48 +		&& ln -s $(PREFIX)/lib/$(lib_so) $(PREFIX)/lib/$(soname) \
    1.49 +		&& ln -s $(PREFIX)/lib/$(soname) $(PREFIX)/lib/$(solink) \
    1.50 +		|| true
    1.51 +	cp $(hdr) $(PREFIX)/include/anim/
    1.52 +
    1.53 +.PHONY: uninstall
    1.54 +uninstall:
    1.55 +	rm -f $(PREFIX)/lib/$(lib_a)
    1.56 +	rm -f $(PREFIX)/lib/$(lib_so)
    1.57 +	rm -f $(PREFIX)/include/anim/*.h
    1.58 +	rmdir $(PREFIX)/include/anim
    1.59 +
    1.60 +.PHONY: clean
    1.61 +clean:
    1.62 +	rm -f $(obj) $(lib_so) $(lib_a)
    1.63 +
    1.64 +.PHONY: distclean
    1.65 +distclean: clean
    1.66 +	rm -f Makefile