gltiki

diff Makefile @ 0:ea177566fe79

initial commit
author John Tsiombikas <nuclear@mutantstargoat.com>
date Sat, 07 Jul 2012 07:07:40 +0300
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/Makefile	Sat Jul 07 07:07:40 2012 +0300
     1.3 @@ -0,0 +1,44 @@
     1.4 +src = $(wildcard src/*.c)
     1.5 +obj = $(src:.c=.o)
     1.6 +dep = $(obj:.o=.d)
     1.7 +name = gltiki
     1.8 +
     1.9 +api_major = 0
    1.10 +api_minor = 1
    1.11 +
    1.12 +dbg = -g
    1.13 +#opt = -O2
    1.14 +
    1.15 +CFLAGS = -pedantic -Wall $(dbg) $(opt) $(pic) -Iinclude -Isrc
    1.16 +LDFLAGS =
    1.17 +
    1.18 +ifeq ($(shell uname -s), Darwin)
    1.19 +	lib_a = $(name).a
    1.20 +	lib_so = $(name).dylib
    1.21 +	soname = -dynamiclib
    1.22 +else
    1.23 +	lib_a = lib$(name).a
    1.24 +	devlink = lib$(name).so
    1.25 +	soname = $(devlink).$(api_major)
    1.26 +	lib_so = $(soname).$(api_minor)
    1.27 +	soname = -shared -Wl,-soname=$(soname)
    1.28 +	pic = -fPIC
    1.29 +endif
    1.30 +
    1.31 +.PHONY: all
    1.32 +all: $(lib_a) $(lib_so)
    1.33 +
    1.34 +$(lib_so): $(obj)
    1.35 +	$(CC) -o $@ $(shared) $(obj) $(LDFLAGS)
    1.36 +
    1.37 +$(lib_a): $(obj)
    1.38 +	$(AR) rcs $@ $(obj)
    1.39 +
    1.40 +-include $(dep)
    1.41 +
    1.42 +%.d: %.c
    1.43 +	@$(CPP) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@
    1.44 +
    1.45 +.PHONY: clean
    1.46 +clean:
    1.47 +	rm -f $(obj) $(bin) $(dep)