goat3dgfx
view 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 |
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 so_major = 0
13 so_minor = 1
15 ifeq ($(shell uname -r), Darwin)
16 lib_so = lib$(name).dylib
17 shared = -dynamiclib
18 else
19 lib_so = lib$(name).so.$(so_major).$(so_minor)
20 soname = lib$(name).so.$(so_major)
21 devlink = lib$(name).so
22 shared = -shared -Wl,-soname=$(soname)
23 pic = -fPIC
24 endif
26 inc = -Isrc -Isrc/vr
27 warn = -Wall
29 libs_ldflags = -limago -lanim -lpsys -lvmath
31 CFLAGS = -pedantic $(warn) $(dbg) $(pic) $(opt) $(inc) $(cfg_cflags) $(libs_cflags)
32 CXXFLAGS = $(CFLAGS)
33 LDFLAGS = $(cfg_ldflags) $(libs_ldflags) -lgoat3d
35 .PHONY: all
36 all: $(lib_so) $(lib_a)
38 $(lib_a): $(obj)
39 $(AR) rcs $@ $(obj)
41 $(lib_so): $(obj)
42 $(CXX) $(shared) -o $@ $(obj) $(LDFLAGS)
44 -include $(dep)
46 %.d: %.c
47 @$(CPP) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@
49 %.d: %.cc
50 @$(CPP) $(CXXFLAGS) $< -MM -MT $(@:.d=.o) >$@
52 .PHONY: clean
53 clean:
54 rm -f $(obj) $(lib_a) $(lib_so)
56 .PHONY: cleandep
57 cleandep:
58 rm -f $(dep)
60 .PHONY: install
61 install: $(lib_so) $(lib_a)
62 mkdir -p $(DESTDIR)$(PREFIX)/lib $(DESTDIR)$(PREFIX)/include/goat3dgfx
63 cp src/*.h src/*.inl $(DESTDIR)$(PREFIX)/include/goat3dgfx/
64 cp $(lib_a) $(DESTDIR)$(PREFIX)/lib/$(lib_a)
65 cp $(lib_so) $(DESTDIR)$(PREFIX)/lib/$(lib_so)
66 [ -n "$(devlink)" ] && \
67 cd $(DESTDIR)$(PREFIX)/lib && \
68 rm -f $(soname) $(devlink) && \
69 ln -s $(lib_so) $(soname) && \
70 ln -s $(soname) $(devlink) || \
71 true
73 .PHONY: uninstall
74 uninstall:
75 rm -f $(DESTDIR)$(PREFIX)/include/goat3dgfx/*
76 rmdir $(DESTDIR)$(PREFIX)/include/goat3dgfx
77 rm -f $(DESTDIR)$(PREFIX)/lib/$(lib_so)
78 rm -f $(DESTDIR)$(PREFIX)/lib/$(lib_a)
79 [ -n "$(devlink)" ] && \
80 rm -f $(DESTDIR)$(PREFIX)/lib/$(soname) && \
81 rm -f $(DESTDIR)$(PREFIX)/lib/$(devlink) || \
82 true