libpsys

changeset 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 d774738f50f6
children a10f19674147
files Makefile.in src/pstrack.h src/psys.c src/psys.h src/rndval.h
diffstat 5 files changed, 31 insertions(+), 28 deletions(-) [+]
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)
     2.1 --- a/src/pstrack.h	Tue Sep 27 07:42:54 2011 +0300
     2.2 +++ b/src/pstrack.h	Tue Sep 27 07:52:01 2011 +0300
     2.3 @@ -1,7 +1,7 @@
     2.4  #ifndef PSTRACK_H_
     2.5  #define PSTRACK_H_
     2.6  
     2.7 -#include <vmath.h>
     2.8 +#include <vmath/vmath.h>
     2.9  #include <anim/anim.h>
    2.10  
    2.11  struct psys_track {
     3.1 --- a/src/psys.c	Tue Sep 27 07:42:54 2011 +0300
     3.2 +++ b/src/psys.c	Tue Sep 27 07:52:01 2011 +0300
     3.3 @@ -2,7 +2,6 @@
     3.4  #include <math.h>
     3.5  #include <assert.h>
     3.6  #include <pthread.h>
     3.7 -#include <vmath.h>
     3.8  #include "psys.h"
     3.9  #include "psys_gl.h"
    3.10  
     4.1 --- a/src/psys.h	Tue Sep 27 07:42:54 2011 +0300
     4.2 +++ b/src/psys.h	Tue Sep 27 07:52:01 2011 +0300
     4.3 @@ -1,7 +1,7 @@
     4.4  #ifndef LIBPSYS_H_
     4.5  #define LIBPSYS_H_
     4.6  
     4.7 -#include <vmath.h>
     4.8 +#include <vmath/vmath.h>
     4.9  #include <anim/anim.h>
    4.10  #include "rndval.h"
    4.11  #include "pattr.h"
     5.1 --- a/src/rndval.h	Tue Sep 27 07:42:54 2011 +0300
     5.2 +++ b/src/rndval.h	Tue Sep 27 07:52:01 2011 +0300
     5.3 @@ -1,7 +1,7 @@
     5.4  #ifndef RNDVAL_H_
     5.5  #define RNDVAL_H_
     5.6  
     5.7 -#include <vmath.h>
     5.8 +#include <vmath/vmath.h>
     5.9  #include "pstrack.h"
    5.10  
    5.11  struct psys_rnd {