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