sgl

annotate Makefile.in @ 16:01a576351090

trying to fix the cocoa module
author John Tsiombikas <nuclear@siggraph.org>
date Fri, 20 May 2011 10:42:54 +0300
parents bf34fa677960
children 12ce0cef7ebf
rev   line source
nuclear@0 1 src = $(wildcard src/*.c)
nuclear@13 2 msrc = $(wildcard src/*.m)
nuclear@0 3 obj = $(src:.c=.o)
nuclear@0 4 dep = $(src:.c=.d)
nuclear@0 5 lib_a = libsgl.a
nuclear@0 6 soname = libsgl.so.$(somajor)
nuclear@0 7 lib_so = $(lib_so_$(sys))
nuclear@0 8
nuclear@0 9 somajor = 0
nuclear@0 10 sominor = 0
nuclear@0 11
nuclear@5 12 lib_so_unix = $(soname).$(sominor)
nuclear@0 13 lib_so_mac = libsgl.dylib
nuclear@0 14
nuclear@0 15 sharedopt_unix = -shared -Wl,-soname,$(soname)
nuclear@0 16 sharedopt_mac = -dynamiclib
nuclear@0 17
nuclear@12 18 ifeq ($(shell uname -s), Darwin)
nuclear@0 19 sys = mac
nuclear@13 20 obj += $(msrc:.m=.o)
nuclear@0 21 else
nuclear@0 22 sys = unix
nuclear@0 23 endif
nuclear@0 24
nuclear@0 25 AR = ar
nuclear@0 26 CC = gcc
nuclear@1 27 CFLAGS = -pedantic -Wall -g -fPIC -Iinclude -Isrc
nuclear@7 28 LDFLAGS = $(wsys_libs)
nuclear@0 29
nuclear@0 30 .PHONY: all
nuclear@0 31 all: $(lib_so) $(lib_a)
nuclear@0 32
nuclear@0 33 $(lib_a): $(obj)
nuclear@0 34 $(AR) rcs $@ $(obj)
nuclear@0 35
nuclear@0 36 $(lib_so): $(obj)
nuclear@5 37 $(CC) $(sharedopt_$(sys)) -o $@ $(obj) $(LDFLAGS)
nuclear@0 38
nuclear@0 39 -include $(dep)
nuclear@0 40
nuclear@0 41 %.d: %.c
nuclear@0 42 @$(CPP) $(CFLAGS) -MM -MT $(@:.d=.o) $< >$@
nuclear@0 43
nuclear@0 44 .PHONY: clean
nuclear@0 45 clean:
nuclear@0 46 rm -f $(obj) $(dep) $(lib_so) $(lib_a)
nuclear@0 47
nuclear@0 48 .PHONY: install
nuclear@0 49 install:
nuclear@0 50 mkdir -p $(PREFIX)/include $(PREFIX)/lib
nuclear@0 51 cp $(lib_a) $(PREFIX)/lib/$(lib_a)
nuclear@0 52 cp $(lib_so) $(PREFIX)/lib/$(lib_so)
nuclear@0 53 cp include/sgl.h $(PREFIX)/include/sgl.h
nuclear@0 54
nuclear@0 55 .PHONY: uninstall
nuclear@0 56 uninstall:
nuclear@0 57 rm -f $(PREFIX)/lib/$(lib_a)
nuclear@0 58 rm -f $(PREFIX)/lib/$(lib_so)
nuclear@0 59 rm -f $(PREFIX)/include/sgl.h