goat3dgfx

view Makefile.in @ 10:b4c9a24c946e

wrote an awesome configure script added "main" 3d engine source file with global init/cleanup
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 24 Nov 2013 13:30:44 +0200
parents Makefile@25b911c7c35c
children d061fe1a31ec
line source
2 csrc = $(wildcard src/*.c)
3 ccsrc = $(wildcard src/*.cc)
4 obj = $(csrc:.c=.o) $(ccsrc:.cc=.o)
5 dep = $(obj:.o=.d)
6 name = goat3dgfx
7 lib_a = lib$(name).a
9 so_major = 0
10 so_minor = 1
12 ifeq ($(shell uname -r), Darwin)
13 lib_so = lib$(name).dylib
14 shared = -dynamiclib
15 else
16 lib_so = lib$(name).so.$(so_major).$(so_minor)
17 soname = lib$(name).so.$(so_major)
18 devlink = lib$(name).so
19 shared = -shared -Wl,-soname=$(soname)
20 pic = -fPIC
21 endif
23 warn = -Wall
25 libs_ldflags = -limago -lanim -lpsys -lvmath
27 CFLAGS = -pedantic $(warn) $(dbg) $(pic) $(opt) $(inc) $(cfg_cflags) $(libs_cflags)
28 CXXFLAGS = $(CFLAGS)
29 LDFLAGS = $(cfg_ldflags) $(libs_ldflags)
31 .PHONY: all
32 all: $(lib_so) $(lib_a)
34 $(lib_a): $(obj)
35 $(AR) rcs $@ $(obj)
37 $(lib_so): $(obj)
38 $(CXX) $(shared) -o $@ $(obj) $(LDFLAGS)
40 -include $(dep)
42 %.d: %.c
43 @$(CPP) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@
45 %.d: %.cc
46 @$(CPP) $(CXXFLAGS) $< -MM -MT $(@:.d=.o) >$@
48 .PHONY: clean
49 clean:
50 rm -f $(obj) $(lib_a) $(lib_so)
52 .PHONY: cleandep
53 cleandep:
54 rm -f $(dep)
56 .PHONY: install
57 install: $(lib_so) $(lib_a)
58 mkdir -p $(DESTDIR)$(PREFIX)/lib $(DESTDIR)$(PREFIX)/include/goat3dgfx
59 cp src/*.h src/*.inl $(DESTDIR)$(PREFIX)/include/goat3dgfx/
60 cp $(lib_a) $(DESTDIR)$(PREFIX)/lib/$(lib_a)
61 cp $(lib_so) $(DESTDIR)$(PREFIX)/lib/$(lib_so)
62 [ -n "$(devlink)" ] && \
63 cd $(DESTDIR)$(PREFIX)/lib && \
64 rm -f $(soname) $(devlink) && \
65 ln -s $(lib_so) $(soname) && \
66 ln -s $(soname) $(devlink) || \
67 true
69 .PHONY: uninstall
70 uninstall:
71 rm -f $(DESTDIR)$(PREFIX)/include/goat3dgfx/*
72 rmdir $(DESTDIR)$(PREFIX)/include/goat3dgfx
73 rm -f $(DESTDIR)$(PREFIX)/lib/$(lib_so)
74 rm -f $(DESTDIR)$(PREFIX)/lib/$(lib_a)
75 [ -n "$(devlink)" ] && \
76 rm -f $(DESTDIR)$(PREFIX)/lib/$(soname) && \
77 rm -f $(DESTDIR)$(PREFIX)/lib/$(devlink) || \
78 true