sgl
view Makefile @ 0:40491760d6e3
starting work on SimplyGL
author | John Tsiombikas <nuclear@siggraph.org> |
---|---|
date | Tue, 10 May 2011 00:06:20 +0300 |
parents | |
children | 0c13a30be2c1 |
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).$(minor)
12 lib_so_mac = libsgl.dylib
14 sharedopt_unix = -shared -Wl,-soname,$(soname)
15 sharedopt_mac = -dynamiclib
17 ifeq ($(shell uname -a), Darwin)
18 sys = mac
19 else
20 sys = unix
21 endif
23 AR = ar
24 CC = gcc
25 CFLAGS = -pedantic -Wall -g -Iinclude
27 .PHONY: all
28 all: $(lib_so) $(lib_a)
30 $(lib_a): $(obj)
31 $(AR) rcs $@ $(obj)
33 $(lib_so): $(obj)
34 $(CC) $(sharedopt_$(sys)) -o $@ $(obj)
36 -include $(dep)
38 %.d: %.c
39 @$(CPP) $(CFLAGS) -MM -MT $(@:.d=.o) $< >$@
41 .PHONY: clean
42 clean:
43 rm -f $(obj) $(dep) $(lib_so) $(lib_a)
45 .PHONY: install
46 install:
47 mkdir -p $(PREFIX)/include $(PREFIX)/lib
48 cp $(lib_a) $(PREFIX)/lib/$(lib_a)
49 cp $(lib_so) $(PREFIX)/lib/$(lib_so)
50 cp include/sgl.h $(PREFIX)/include/sgl.h
52 .PHONY: uninstall
53 uninstall:
54 rm -f $(PREFIX)/lib/$(lib_a)
55 rm -f $(PREFIX)/lib/$(lib_so)
56 rm -f $(PREFIX)/include/sgl.h