sgl

annotate Makefile.in @ 30:6242b03e7191

merged with win32 branch
author John Tsiombikas <nuclear@member.fsf.org>
date Tue, 28 Jun 2011 13:52:02 +0300
parents 12ce0cef7ebf
children 3d6ee9fb9ac1
rev   line source
nuclear@0 1 src = $(wildcard src/*.c)
nuclear@13 2 msrc = $(wildcard src/*.m)
nuclear@19 3 obj = $(src:.c=.o) $(msrc:.m=.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@0 20 else
nuclear@0 21 sys = unix
nuclear@0 22 endif
nuclear@0 23
nuclear@0 24 AR = ar
nuclear@0 25 CC = gcc
nuclear@20 26 CFLAGS = -pedantic -Wall -g -fPIC -Iinclude -Isrc $(CFLAGS_extra)
nuclear@7 27 LDFLAGS = $(wsys_libs)
nuclear@0 28
nuclear@0 29 .PHONY: all
nuclear@0 30 all: $(lib_so) $(lib_a)
nuclear@0 31
nuclear@0 32 $(lib_a): $(obj)
nuclear@0 33 $(AR) rcs $@ $(obj)
nuclear@0 34
nuclear@0 35 $(lib_so): $(obj)
nuclear@5 36 $(CC) $(sharedopt_$(sys)) -o $@ $(obj) $(LDFLAGS)
nuclear@0 37
nuclear@20 38 %.o: %.m
nuclear@20 39 $(CC) $(CFLAGS) -c -o $@ $<
nuclear@20 40
nuclear@0 41 -include $(dep)
nuclear@0 42
nuclear@0 43 %.d: %.c
nuclear@0 44 @$(CPP) $(CFLAGS) -MM -MT $(@:.d=.o) $< >$@
nuclear@0 45
nuclear@0 46 .PHONY: clean
nuclear@0 47 clean:
nuclear@0 48 rm -f $(obj) $(dep) $(lib_so) $(lib_a)
nuclear@0 49
nuclear@0 50 .PHONY: install
nuclear@0 51 install:
nuclear@0 52 mkdir -p $(PREFIX)/include $(PREFIX)/lib
nuclear@0 53 cp $(lib_a) $(PREFIX)/lib/$(lib_a)
nuclear@0 54 cp $(lib_so) $(PREFIX)/lib/$(lib_so)
nuclear@0 55 cp include/sgl.h $(PREFIX)/include/sgl.h
nuclear@0 56
nuclear@0 57 .PHONY: uninstall
nuclear@0 58 uninstall:
nuclear@0 59 rm -f $(PREFIX)/lib/$(lib_a)
nuclear@0 60 rm -f $(PREFIX)/lib/$(lib_so)
nuclear@0 61 rm -f $(PREFIX)/include/sgl.h