goat3dgfx
view Makefile.in @ 31:3ba80928b530
fixed the build
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sun, 02 Mar 2014 04:20:00 +0200 |
parents | 7d6b667821cf |
children | 7f0aed0fe289 |
line source
1 ifdef use_vr
2 vr_ccsrc = $(wildcard src/vr/*.cc)
3 endif
5 csrc = $(wildcard src/*.c)
6 ccsrc = $(wildcard src/*.cc) $(vr_ccsrc)
7 obj = $(csrc:.c=.o) $(ccsrc:.cc=.o)
8 dep = $(obj:.o=.d)
9 name = goat3dgfx
10 lib_a = lib$(name).a
12 pcfile = $(name).pc
14 so_major = 0
15 so_minor = 1
17 ifeq ($(shell uname -r), Darwin)
18 lib_so = lib$(name).dylib
19 shared = -dynamiclib
20 else
21 lib_so = lib$(name).so.$(so_major).$(so_minor)
22 soname = lib$(name).so.$(so_major)
23 devlink = lib$(name).so
24 shared = -shared -Wl,-soname=$(soname)
25 pic = -fPIC
26 endif
28 inc = -Isrc -Isrc/vr
29 warn = -Wall
31 libs_ldflags = -limago -lanim -lpsys -lvmath -lresman
33 CFLAGS = -pedantic $(warn) $(dbg) $(pic) $(opt) $(inc) $(cfg_cflags) $(libs_cflags)
34 CXXFLAGS = $(CFLAGS)
35 LDFLAGS = $(cfg_ldflags) $(libs_ldflags) -lgoat3d
37 .PHONY: all
38 all: $(lib_so) $(lib_a)
40 $(lib_a): $(obj)
41 $(AR) rcs $@ $(obj)
43 $(lib_so): $(obj)
44 $(CXX) $(shared) -o $@ $(obj) $(LDFLAGS)
46 -include $(dep)
48 %.d: %.c
49 @$(CPP) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@
51 %.d: %.cc
52 @$(CPP) $(CXXFLAGS) $< -MM -MT $(@:.d=.o) >$@
54 .PHONY: clean
55 clean:
56 rm -f $(obj) $(lib_a) $(lib_so)
58 .PHONY: cleandep
59 cleandep:
60 rm -f $(dep)
62 .PHONY: install
63 install: $(lib_so) $(lib_a)
64 mkdir -p $(DESTDIR)$(PREFIX)/lib $(DESTDIR)$(PREFIX)/include/goat3dgfx
65 cp src/*.h src/*.inl $(DESTDIR)$(PREFIX)/include/goat3dgfx/
66 cp $(lib_a) $(DESTDIR)$(PREFIX)/lib/$(lib_a)
67 cp $(lib_so) $(DESTDIR)$(PREFIX)/lib/$(lib_so)
68 [ -n "$(devlink)" ] && \
69 cd $(DESTDIR)$(PREFIX)/lib && \
70 rm -f $(soname) $(devlink) && \
71 ln -s $(lib_so) $(soname) && \
72 ln -s $(soname) $(devlink) || \
73 true
74 mkdir -p $(DESTDIR)$(PREFIX)/share/pkgconfig
75 cp $(pcfile) $(DESTDIR)$(PREFIX)/share/pkgconfig/$(pcfile)
77 .PHONY: uninstall
78 uninstall:
79 rm -f $(DESTDIR)$(PREFIX)/include/goat3dgfx/*
80 rmdir $(DESTDIR)$(PREFIX)/include/goat3dgfx
81 rm -f $(DESTDIR)$(PREFIX)/lib/$(lib_so)
82 rm -f $(DESTDIR)$(PREFIX)/lib/$(lib_a)
83 [ -n "$(devlink)" ] && \
84 rm -f $(DESTDIR)$(PREFIX)/lib/$(soname) && \
85 rm -f $(DESTDIR)$(PREFIX)/lib/$(devlink) || \
86 true
87 rm -f $(DESTDIR)$(PREFIX)/share/pkgconfig/$(pcfile)