goat3dgfx

annotate Makefile.in @ 17:f2da87b02fcd

fixes mostly visual studio stuff
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 01 Dec 2013 02:25:29 +0200
parents 1868c5975f31
children 0ac499409edd
rev   line source
nuclear@11 1 ifdef use_vr
nuclear@11 2 vr_ccsrc = $(wildcard src/vr/*.cc)
nuclear@11 3 endif
nuclear@0 4
nuclear@0 5 csrc = $(wildcard src/*.c)
nuclear@11 6 ccsrc = $(wildcard src/*.cc) $(vr_ccsrc)
nuclear@0 7 obj = $(csrc:.c=.o) $(ccsrc:.cc=.o)
nuclear@0 8 dep = $(obj:.o=.d)
nuclear@0 9 name = goat3dgfx
nuclear@0 10 lib_a = lib$(name).a
nuclear@0 11
nuclear@0 12 so_major = 0
nuclear@0 13 so_minor = 1
nuclear@0 14
nuclear@0 15 ifeq ($(shell uname -r), Darwin)
nuclear@0 16 lib_so = lib$(name).dylib
nuclear@0 17 shared = -dynamiclib
nuclear@0 18 else
nuclear@0 19 lib_so = lib$(name).so.$(so_major).$(so_minor)
nuclear@0 20 soname = lib$(name).so.$(so_major)
nuclear@0 21 devlink = lib$(name).so
nuclear@0 22 shared = -shared -Wl,-soname=$(soname)
nuclear@0 23 pic = -fPIC
nuclear@0 24 endif
nuclear@0 25
nuclear@12 26 inc = -Isrc -Isrc/vr
nuclear@8 27 warn = -Wall
nuclear@0 28
nuclear@9 29 libs_ldflags = -limago -lanim -lpsys -lvmath
nuclear@9 30
nuclear@10 31 CFLAGS = -pedantic $(warn) $(dbg) $(pic) $(opt) $(inc) $(cfg_cflags) $(libs_cflags)
nuclear@0 32 CXXFLAGS = $(CFLAGS)
nuclear@15 33 LDFLAGS = $(cfg_ldflags) $(libs_ldflags) -lgoat3d
nuclear@0 34
nuclear@0 35 .PHONY: all
nuclear@0 36 all: $(lib_so) $(lib_a)
nuclear@0 37
nuclear@0 38 $(lib_a): $(obj)
nuclear@0 39 $(AR) rcs $@ $(obj)
nuclear@0 40
nuclear@0 41 $(lib_so): $(obj)
nuclear@0 42 $(CXX) $(shared) -o $@ $(obj) $(LDFLAGS)
nuclear@0 43
nuclear@0 44 -include $(dep)
nuclear@0 45
nuclear@0 46 %.d: %.c
nuclear@0 47 @$(CPP) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@
nuclear@0 48
nuclear@0 49 %.d: %.cc
nuclear@0 50 @$(CPP) $(CXXFLAGS) $< -MM -MT $(@:.d=.o) >$@
nuclear@0 51
nuclear@0 52 .PHONY: clean
nuclear@0 53 clean:
nuclear@0 54 rm -f $(obj) $(lib_a) $(lib_so)
nuclear@0 55
nuclear@0 56 .PHONY: cleandep
nuclear@0 57 cleandep:
nuclear@0 58 rm -f $(dep)
nuclear@0 59
nuclear@0 60 .PHONY: install
nuclear@0 61 install: $(lib_so) $(lib_a)
nuclear@0 62 mkdir -p $(DESTDIR)$(PREFIX)/lib $(DESTDIR)$(PREFIX)/include/goat3dgfx
nuclear@0 63 cp src/*.h src/*.inl $(DESTDIR)$(PREFIX)/include/goat3dgfx/
nuclear@0 64 cp $(lib_a) $(DESTDIR)$(PREFIX)/lib/$(lib_a)
nuclear@0 65 cp $(lib_so) $(DESTDIR)$(PREFIX)/lib/$(lib_so)
nuclear@0 66 [ -n "$(devlink)" ] && \
nuclear@0 67 cd $(DESTDIR)$(PREFIX)/lib && \
nuclear@0 68 rm -f $(soname) $(devlink) && \
nuclear@0 69 ln -s $(lib_so) $(soname) && \
nuclear@0 70 ln -s $(soname) $(devlink) || \
nuclear@0 71 true
nuclear@0 72
nuclear@0 73 .PHONY: uninstall
nuclear@0 74 uninstall:
nuclear@0 75 rm -f $(DESTDIR)$(PREFIX)/include/goat3dgfx/*
nuclear@0 76 rmdir $(DESTDIR)$(PREFIX)/include/goat3dgfx
nuclear@0 77 rm -f $(DESTDIR)$(PREFIX)/lib/$(lib_so)
nuclear@0 78 rm -f $(DESTDIR)$(PREFIX)/lib/$(lib_a)
nuclear@0 79 [ -n "$(devlink)" ] && \
nuclear@0 80 rm -f $(DESTDIR)$(PREFIX)/lib/$(soname) && \
nuclear@0 81 rm -f $(DESTDIR)$(PREFIX)/lib/$(devlink) || \
nuclear@0 82 true