sgl

diff 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 diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/Makefile	Tue May 10 00:06:20 2011 +0300
     1.3 @@ -0,0 +1,56 @@
     1.4 +src = $(wildcard src/*.c)
     1.5 +obj = $(src:.c=.o)
     1.6 +dep = $(src:.c=.d)
     1.7 +lib_a = libsgl.a
     1.8 +soname = libsgl.so.$(somajor)
     1.9 +lib_so = $(lib_so_$(sys))
    1.10 +
    1.11 +somajor = 0
    1.12 +sominor = 0
    1.13 +
    1.14 +lib_so_unix = $(soname).$(minor)
    1.15 +lib_so_mac = libsgl.dylib
    1.16 +
    1.17 +sharedopt_unix = -shared -Wl,-soname,$(soname)
    1.18 +sharedopt_mac = -dynamiclib
    1.19 +
    1.20 +ifeq ($(shell uname -a), Darwin)
    1.21 +	sys = mac
    1.22 +else
    1.23 +	sys = unix
    1.24 +endif
    1.25 +
    1.26 +AR = ar
    1.27 +CC = gcc
    1.28 +CFLAGS = -pedantic -Wall -g -Iinclude
    1.29 +
    1.30 +.PHONY: all
    1.31 +all: $(lib_so) $(lib_a)
    1.32 +
    1.33 +$(lib_a): $(obj)
    1.34 +	$(AR) rcs $@ $(obj)
    1.35 +
    1.36 +$(lib_so): $(obj)
    1.37 +	$(CC) $(sharedopt_$(sys)) -o $@ $(obj)
    1.38 +
    1.39 +-include $(dep)
    1.40 +
    1.41 +%.d: %.c
    1.42 +	@$(CPP) $(CFLAGS) -MM -MT $(@:.d=.o) $< >$@
    1.43 +
    1.44 +.PHONY: clean
    1.45 +clean:
    1.46 +	rm -f $(obj) $(dep) $(lib_so) $(lib_a)
    1.47 +
    1.48 +.PHONY: install
    1.49 +install:
    1.50 +	mkdir -p $(PREFIX)/include $(PREFIX)/lib
    1.51 +	cp $(lib_a) $(PREFIX)/lib/$(lib_a)
    1.52 +	cp $(lib_so) $(PREFIX)/lib/$(lib_so)
    1.53 +	cp include/sgl.h $(PREFIX)/include/sgl.h
    1.54 +
    1.55 +.PHONY: uninstall
    1.56 +uninstall:
    1.57 +	rm -f $(PREFIX)/lib/$(lib_a)
    1.58 +	rm -f $(PREFIX)/lib/$(lib_so)
    1.59 +	rm -f $(PREFIX)/include/sgl.h