libpsys

diff Makefile.in @ 7:3c0a306c5f01

revamped the makefile a bit and changed all <vmath.h> to <vmath/vmath.h> to avoid relying on pkg-config
author John Tsiombikas <nuclear@mutantstargoat.com>
date Tue, 27 Sep 2011 07:52:01 +0300
parents 1c8eb90a6989
children 9c24273f211b
line diff
     1.1 --- a/Makefile.in	Tue Sep 27 07:42:54 2011 +0300
     1.2 +++ b/Makefile.in	Tue Sep 27 07:52:01 2011 +0300
     1.3 @@ -1,45 +1,49 @@
     1.4  src = $(wildcard src/*.c)
     1.5  obj = $(src:.c=.o)
     1.6 +dep = $(obj:.o=.d)
     1.7  lib_a = libpsys.a
     1.8 -lib_so = libpsys.so
     1.9 +
    1.10 +ifeq ($(shell uname -s), Darwin)
    1.11 +	lib_so = psys.dylib
    1.12 +	shared = -dynamiclib
    1.13 +else
    1.14 +	somajor = 0
    1.15 +	sominor = 1
    1.16 +	soname = libpsys.so.$(somajor)
    1.17 +	lib_so = $(soname).$(sominor)
    1.18 +	solink = libpsys.so
    1.19 +	shared = -shared -Wl,-soname,$(soname)
    1.20 +endif
    1.21 +
    1.22  
    1.23  CC = gcc
    1.24 -CFLAGS = -std=c89 -pedantic -Wall -g -fPIC -Isrc `pkg-config --cflags vmath`
    1.25 -LDFLAGS = `pkg-config --libs vmath`
    1.26 +AR = ar
    1.27 +CFLAGS = -std=c89 -pedantic -Wall -g -fPIC -Isrc
    1.28 +LDFLAGS = -lanim -limago -lvmath
    1.29  
    1.30  .PHONY: all
    1.31  all: $(lib_a) $(lib_so)
    1.32  
    1.33  $(lib_a): $(obj)
    1.34 -	$(AR) rcs $@ $^
    1.35 +	$(AR) rcs $@ $(obj)
    1.36  
    1.37  $(lib_so): $(obj)
    1.38 -	$(CC) $(CFLAGS) -shared -o $@ $^ $(LDFLAGS)
    1.39 +	$(CC) $(shared) -o $@ $(obj) $(LDFLAGS)
    1.40 +
    1.41 +-include $(dep)
    1.42 +
    1.43 +%.d: %.c
    1.44 +	@$(CPP) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@
    1.45 +
    1.46  
    1.47  .PHONY: install
    1.48  install: $(lib_a) $(lib_so)
    1.49 -	install -d $(PREFIX)/lib
    1.50 -	install -m 644 $(lib_a) $(lib_so) $(PREFIX)/lib
    1.51 -	install -d $(PREFIX)/include
    1.52 -	install -m 644 src/psys.h $(PREFIX)/include/psys.h
    1.53 -	install -d $(PREFIX)/lib/pkgconfig
    1.54 -	install -m 644 psys.pc $(PREFIX)/lib/pkgconfig/psys.pc
    1.55 +	@echo TODO
    1.56  
    1.57  .PHONY: uninstall
    1.58  uninstall:
    1.59 -	rm -f $(PREFIX)/lib/$(lib_a)
    1.60 -	rm -f $(PREFIX)/lib/$(lib_so)
    1.61 -	rm -f $(PREFIX)/include/psys.h
    1.62 -	rm -f $(PREFIX)/lib/pkgconfig/psys.pc
    1.63 +	@echo TODO
    1.64  
    1.65  .PHONY: clean
    1.66  clean:
    1.67 -	rm -f $(obj)
    1.68 -
    1.69 -.PHONY: distclean
    1.70 -distclean:
    1.71 -	rm -f $(obj) $(lib_so) $(lib_a) Makefile psys.pc
    1.72 -
    1.73 -.PHONY: dist
    1.74 -dist: distclean
    1.75 -	cd ..; tar czvf psys.tar.gz psys && mv psys.tar.gz psys/
    1.76 +	rm -f $(obj) $(lib_so) $(lib_a)