sgl

annotate Makefile.in @ 2:e55e71da991d

converting to configure/makefile.in
author John Tsiombikas <nuclear@siggraph.org>
date Wed, 11 May 2011 05:53:26 +0300
parents Makefile@0c13a30be2c1
children 0570e27e5ebc
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@0 11 lib_so_unix = $(soname).$(minor)
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@0 26
nuclear@0 27 .PHONY: all
nuclear@0 28 all: $(lib_so) $(lib_a)
nuclear@0 29
nuclear@0 30 $(lib_a): $(obj)
nuclear@0 31 $(AR) rcs $@ $(obj)
nuclear@0 32
nuclear@0 33 $(lib_so): $(obj)
nuclear@0 34 $(CC) $(sharedopt_$(sys)) -o $@ $(obj)
nuclear@0 35
nuclear@0 36 -include $(dep)
nuclear@0 37
nuclear@0 38 %.d: %.c
nuclear@0 39 @$(CPP) $(CFLAGS) -MM -MT $(@:.d=.o) $< >$@
nuclear@0 40
nuclear@0 41 .PHONY: clean
nuclear@0 42 clean:
nuclear@0 43 rm -f $(obj) $(dep) $(lib_so) $(lib_a)
nuclear@0 44
nuclear@0 45 .PHONY: install
nuclear@0 46 install:
nuclear@0 47 mkdir -p $(PREFIX)/include $(PREFIX)/lib
nuclear@0 48 cp $(lib_a) $(PREFIX)/lib/$(lib_a)
nuclear@0 49 cp $(lib_so) $(PREFIX)/lib/$(lib_so)
nuclear@0 50 cp include/sgl.h $(PREFIX)/include/sgl.h
nuclear@0 51
nuclear@0 52 .PHONY: uninstall
nuclear@0 53 uninstall:
nuclear@0 54 rm -f $(PREFIX)/lib/$(lib_a)
nuclear@0 55 rm -f $(PREFIX)/lib/$(lib_so)
nuclear@0 56 rm -f $(PREFIX)/include/sgl.h