sgl

view Makefile.in @ 24:23a01d912cf8

on a whim, added vs2010 projects
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 27 Jun 2011 10:49:01 +0300
parents 12ce0cef7ebf
children 3d6ee9fb9ac1
line source
1 src = $(wildcard src/*.c)
2 msrc = $(wildcard src/*.m)
3 obj = $(src:.c=.o) $(msrc:.m=.o)
4 dep = $(src:.c=.d)
5 lib_a = libsgl.a
6 soname = libsgl.so.$(somajor)
7 lib_so = $(lib_so_$(sys))
9 somajor = 0
10 sominor = 0
12 lib_so_unix = $(soname).$(sominor)
13 lib_so_mac = libsgl.dylib
15 sharedopt_unix = -shared -Wl,-soname,$(soname)
16 sharedopt_mac = -dynamiclib
18 ifeq ($(shell uname -s), Darwin)
19 sys = mac
20 else
21 sys = unix
22 endif
24 AR = ar
25 CC = gcc
26 CFLAGS = -pedantic -Wall -g -fPIC -Iinclude -Isrc $(CFLAGS_extra)
27 LDFLAGS = $(wsys_libs)
29 .PHONY: all
30 all: $(lib_so) $(lib_a)
32 $(lib_a): $(obj)
33 $(AR) rcs $@ $(obj)
35 $(lib_so): $(obj)
36 $(CC) $(sharedopt_$(sys)) -o $@ $(obj) $(LDFLAGS)
38 %.o: %.m
39 $(CC) $(CFLAGS) -c -o $@ $<
41 -include $(dep)
43 %.d: %.c
44 @$(CPP) $(CFLAGS) -MM -MT $(@:.d=.o) $< >$@
46 .PHONY: clean
47 clean:
48 rm -f $(obj) $(dep) $(lib_so) $(lib_a)
50 .PHONY: install
51 install:
52 mkdir -p $(PREFIX)/include $(PREFIX)/lib
53 cp $(lib_a) $(PREFIX)/lib/$(lib_a)
54 cp $(lib_so) $(PREFIX)/lib/$(lib_so)
55 cp include/sgl.h $(PREFIX)/include/sgl.h
57 .PHONY: uninstall
58 uninstall:
59 rm -f $(PREFIX)/lib/$(lib_a)
60 rm -f $(PREFIX)/lib/$(lib_so)
61 rm -f $(PREFIX)/include/sgl.h