sgl
view Makefile.in @ 12:bf34fa677960
- fixed mac issues.
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sat, 14 May 2011 12:02:22 +0300 |
parents | edbfc96fe80d |
children | e989ab58ec5b |
line source
1 src = $(wildcard src/*.c)
2 obj = $(src:.c=.o)
3 dep = $(src:.c=.d)
4 lib_a = libsgl.a
5 soname = libsgl.so.$(somajor)
6 lib_so = $(lib_so_$(sys))
8 somajor = 0
9 sominor = 0
11 lib_so_unix = $(soname).$(sominor)
12 lib_so_mac = libsgl.dylib
14 sharedopt_unix = -shared -Wl,-soname,$(soname)
15 sharedopt_mac = -dynamiclib
17 ifeq ($(shell uname -s), Darwin)
18 sys = mac
19 else
20 sys = unix
21 endif
23 AR = ar
24 CC = gcc
25 CFLAGS = -pedantic -Wall -g -fPIC -Iinclude -Isrc
26 LDFLAGS = $(wsys_libs)
28 .PHONY: all
29 all: $(lib_so) $(lib_a)
31 $(lib_a): $(obj)
32 $(AR) rcs $@ $(obj)
34 $(lib_so): $(obj)
35 $(CC) $(sharedopt_$(sys)) -o $@ $(obj) $(LDFLAGS)
37 -include $(dep)
39 %.d: %.c
40 @$(CPP) $(CFLAGS) -MM -MT $(@:.d=.o) $< >$@
42 .PHONY: clean
43 clean:
44 rm -f $(obj) $(dep) $(lib_so) $(lib_a)
46 .PHONY: install
47 install:
48 mkdir -p $(PREFIX)/include $(PREFIX)/lib
49 cp $(lib_a) $(PREFIX)/lib/$(lib_a)
50 cp $(lib_so) $(PREFIX)/lib/$(lib_so)
51 cp include/sgl.h $(PREFIX)/include/sgl.h
53 .PHONY: uninstall
54 uninstall:
55 rm -f $(PREFIX)/lib/$(lib_a)
56 rm -f $(PREFIX)/lib/$(lib_so)
57 rm -f $(PREFIX)/include/sgl.h