goat3dgfx

diff 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 diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/Makefile.in	Sun Nov 24 13:30:44 2013 +0200
     1.3 @@ -0,0 +1,78 @@
     1.4 +
     1.5 +csrc = $(wildcard src/*.c)
     1.6 +ccsrc = $(wildcard src/*.cc)
     1.7 +obj = $(csrc:.c=.o) $(ccsrc:.cc=.o)
     1.8 +dep = $(obj:.o=.d)
     1.9 +name = goat3dgfx
    1.10 +lib_a = lib$(name).a
    1.11 +
    1.12 +so_major = 0
    1.13 +so_minor = 1
    1.14 +
    1.15 +ifeq ($(shell uname -r), Darwin)
    1.16 +	lib_so = lib$(name).dylib
    1.17 +	shared = -dynamiclib
    1.18 +else
    1.19 +	lib_so = lib$(name).so.$(so_major).$(so_minor)
    1.20 +	soname = lib$(name).so.$(so_major)
    1.21 +	devlink = lib$(name).so
    1.22 +	shared = -shared -Wl,-soname=$(soname)
    1.23 +	pic = -fPIC
    1.24 +endif
    1.25 +
    1.26 +warn = -Wall
    1.27 +
    1.28 +libs_ldflags = -limago -lanim -lpsys -lvmath
    1.29 +
    1.30 +CFLAGS = -pedantic $(warn) $(dbg) $(pic) $(opt) $(inc) $(cfg_cflags) $(libs_cflags)
    1.31 +CXXFLAGS =  $(CFLAGS)
    1.32 +LDFLAGS = $(cfg_ldflags) $(libs_ldflags)
    1.33 +
    1.34 +.PHONY: all
    1.35 +all: $(lib_so) $(lib_a)
    1.36 +
    1.37 +$(lib_a): $(obj)
    1.38 +	$(AR) rcs $@ $(obj)
    1.39 +
    1.40 +$(lib_so): $(obj)
    1.41 +	$(CXX) $(shared) -o $@ $(obj) $(LDFLAGS)
    1.42 +
    1.43 +-include $(dep)
    1.44 +
    1.45 +%.d: %.c
    1.46 +	@$(CPP) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@
    1.47 +
    1.48 +%.d: %.cc
    1.49 +	@$(CPP) $(CXXFLAGS) $< -MM -MT $(@:.d=.o) >$@
    1.50 +
    1.51 +.PHONY: clean
    1.52 +clean:
    1.53 +	rm -f $(obj) $(lib_a) $(lib_so)
    1.54 +
    1.55 +.PHONY: cleandep
    1.56 +cleandep:
    1.57 +	rm -f $(dep)
    1.58 +
    1.59 +.PHONY: install
    1.60 +install: $(lib_so) $(lib_a)
    1.61 +	mkdir -p $(DESTDIR)$(PREFIX)/lib $(DESTDIR)$(PREFIX)/include/goat3dgfx
    1.62 +	cp src/*.h src/*.inl $(DESTDIR)$(PREFIX)/include/goat3dgfx/
    1.63 +	cp $(lib_a) $(DESTDIR)$(PREFIX)/lib/$(lib_a)
    1.64 +	cp $(lib_so) $(DESTDIR)$(PREFIX)/lib/$(lib_so)
    1.65 +	[ -n "$(devlink)" ] && \
    1.66 +		cd $(DESTDIR)$(PREFIX)/lib && \
    1.67 +		rm -f $(soname) $(devlink) && \
    1.68 +		ln -s $(lib_so) $(soname) && \
    1.69 +		ln -s $(soname) $(devlink) || \
    1.70 +		true
    1.71 +
    1.72 +.PHONY: uninstall
    1.73 +uninstall:
    1.74 +	rm -f $(DESTDIR)$(PREFIX)/include/goat3dgfx/*
    1.75 +	rmdir $(DESTDIR)$(PREFIX)/include/goat3dgfx
    1.76 +	rm -f $(DESTDIR)$(PREFIX)/lib/$(lib_so)
    1.77 +	rm -f $(DESTDIR)$(PREFIX)/lib/$(lib_a)
    1.78 +	[ -n "$(devlink)" ] && \
    1.79 +		rm -f $(DESTDIR)$(PREFIX)/lib/$(soname) && \
    1.80 +		rm -f $(DESTDIR)$(PREFIX)/lib/$(devlink) || \
    1.81 +		true