sgl
annotate Makefile.in @ 6:0cb438c86b98
X11 sounds about ready
author | John Tsiombikas <nuclear@siggraph.org> |
---|---|
date | Fri, 13 May 2011 09:44:21 +0300 |
parents | e55e71da991d |
children | edbfc96fe80d |
rev | line source |
---|---|
nuclear@0 | 1 src = $(wildcard src/*.c) |
nuclear@0 | 2 obj = $(src:.c=.o) |
nuclear@0 | 3 dep = $(src:.c=.d) |
nuclear@0 | 4 lib_a = libsgl.a |
nuclear@0 | 5 soname = libsgl.so.$(somajor) |
nuclear@0 | 6 lib_so = $(lib_so_$(sys)) |
nuclear@0 | 7 |
nuclear@0 | 8 somajor = 0 |
nuclear@0 | 9 sominor = 0 |
nuclear@0 | 10 |
nuclear@5 | 11 lib_so_unix = $(soname).$(sominor) |
nuclear@0 | 12 lib_so_mac = libsgl.dylib |
nuclear@0 | 13 |
nuclear@0 | 14 sharedopt_unix = -shared -Wl,-soname,$(soname) |
nuclear@0 | 15 sharedopt_mac = -dynamiclib |
nuclear@0 | 16 |
nuclear@0 | 17 ifeq ($(shell uname -a), Darwin) |
nuclear@0 | 18 sys = mac |
nuclear@0 | 19 else |
nuclear@0 | 20 sys = unix |
nuclear@0 | 21 endif |
nuclear@0 | 22 |
nuclear@0 | 23 AR = ar |
nuclear@0 | 24 CC = gcc |
nuclear@1 | 25 CFLAGS = -pedantic -Wall -g -fPIC -Iinclude -Isrc |
nuclear@5 | 26 LDFLAGS = -lX11 |
nuclear@0 | 27 |
nuclear@0 | 28 .PHONY: all |
nuclear@0 | 29 all: $(lib_so) $(lib_a) |
nuclear@0 | 30 |
nuclear@0 | 31 $(lib_a): $(obj) |
nuclear@0 | 32 $(AR) rcs $@ $(obj) |
nuclear@0 | 33 |
nuclear@0 | 34 $(lib_so): $(obj) |
nuclear@5 | 35 $(CC) $(sharedopt_$(sys)) -o $@ $(obj) $(LDFLAGS) |
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) $(dep) $(lib_so) $(lib_a) |
nuclear@0 | 45 |
nuclear@0 | 46 .PHONY: install |
nuclear@0 | 47 install: |
nuclear@0 | 48 mkdir -p $(PREFIX)/include $(PREFIX)/lib |
nuclear@0 | 49 cp $(lib_a) $(PREFIX)/lib/$(lib_a) |
nuclear@0 | 50 cp $(lib_so) $(PREFIX)/lib/$(lib_so) |
nuclear@0 | 51 cp include/sgl.h $(PREFIX)/include/sgl.h |
nuclear@0 | 52 |
nuclear@0 | 53 .PHONY: uninstall |
nuclear@0 | 54 uninstall: |
nuclear@0 | 55 rm -f $(PREFIX)/lib/$(lib_a) |
nuclear@0 | 56 rm -f $(PREFIX)/lib/$(lib_so) |
nuclear@0 | 57 rm -f $(PREFIX)/include/sgl.h |