gltiki

annotate Makefile @ 1:124cce992161

added .hgignore
author John Tsiombikas <nuclear@mutantstargoat.com>
date Sat, 07 Jul 2012 07:09:29 +0300
parents
children
rev   line source
nuclear@0 1 src = $(wildcard src/*.c)
nuclear@0 2 obj = $(src:.c=.o)
nuclear@0 3 dep = $(obj:.o=.d)
nuclear@0 4 name = gltiki
nuclear@0 5
nuclear@0 6 api_major = 0
nuclear@0 7 api_minor = 1
nuclear@0 8
nuclear@0 9 dbg = -g
nuclear@0 10 #opt = -O2
nuclear@0 11
nuclear@0 12 CFLAGS = -pedantic -Wall $(dbg) $(opt) $(pic) -Iinclude -Isrc
nuclear@0 13 LDFLAGS =
nuclear@0 14
nuclear@0 15 ifeq ($(shell uname -s), Darwin)
nuclear@0 16 lib_a = $(name).a
nuclear@0 17 lib_so = $(name).dylib
nuclear@0 18 soname = -dynamiclib
nuclear@0 19 else
nuclear@0 20 lib_a = lib$(name).a
nuclear@0 21 devlink = lib$(name).so
nuclear@0 22 soname = $(devlink).$(api_major)
nuclear@0 23 lib_so = $(soname).$(api_minor)
nuclear@0 24 soname = -shared -Wl,-soname=$(soname)
nuclear@0 25 pic = -fPIC
nuclear@0 26 endif
nuclear@0 27
nuclear@0 28 .PHONY: all
nuclear@0 29 all: $(lib_a) $(lib_so)
nuclear@0 30
nuclear@0 31 $(lib_so): $(obj)
nuclear@0 32 $(CC) -o $@ $(shared) $(obj) $(LDFLAGS)
nuclear@0 33
nuclear@0 34 $(lib_a): $(obj)
nuclear@0 35 $(AR) rcs $@ $(obj)
nuclear@0 36
nuclear@0 37 -include $(dep)
nuclear@0 38
nuclear@0 39 %.d: %.c
nuclear@0 40 @$(CPP) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@
nuclear@0 41
nuclear@0 42 .PHONY: clean
nuclear@0 43 clean:
nuclear@0 44 rm -f $(obj) $(bin) $(dep)