libanim

annotate Makefile.in @ 78:769ae86eee31

makefile modified to build on mingw
author John Tsiombikas <nuclear@member.fsf.org>
date Wed, 16 Sep 2015 04:24:12 +0300
parents f12663c5c907
children
rev   line source
nuclear@0 1 src = $(wildcard src/*.c)
nuclear@0 2 hdr = src/track.h src/anim.h src/config.h
nuclear@0 3 obj = $(src:.c=.o)
nuclear@0 4 dep = $(obj:.o=.d)
nuclear@0 5 lib_a = libanim.a
nuclear@0 6
nuclear@78 7 sys := $(patsubst MINGW32%,MINGW32,$(shell uname -s))
nuclear@78 8 ifeq ($(sys), Darwin)
nuclear@33 9 lib_so = libanim.dylib
nuclear@0 10 shared = -dynamiclib
nuclear@78 11 else ifeq ($(sys), MINGW32)
nuclear@78 12 lib_so = libanim.dll
nuclear@78 13 shared = -shared
nuclear@0 14 else
nuclear@0 15 somajor = 0
nuclear@0 16 sominor = 1
nuclear@0 17 soname = libanim.so.$(somajor)
nuclear@0 18 lib_so = $(soname).$(sominor)
nuclear@0 19 solink = libanim.so
nuclear@0 20 shared = -shared -Wl,-soname,$(soname)
nuclear@78 21 pic = -fPIC
nuclear@0 22 endif
nuclear@0 23
nuclear@0 24
nuclear@0 25 CC = gcc
nuclear@0 26 AR = ar
nuclear@78 27 CFLAGS = $(opt) $(dbg) -pedantic -Wall $(pic) -I$(PREFIX)/include
nuclear@0 28 LDFLAGS = -L$(PREFIX)/lib -lvmath -lm -lpthread
nuclear@0 29
nuclear@0 30 .PHONY: all
nuclear@0 31 all: $(lib_a) $(lib_so)
nuclear@0 32
nuclear@0 33 $(lib_a): $(obj)
nuclear@0 34 $(AR) rcs $@ $(obj)
nuclear@0 35
nuclear@0 36 $(lib_so): $(obj)
nuclear@0 37 $(CC) $(shared) -o $@ $(obj) $(LDFLAGS)
nuclear@0 38
nuclear@0 39 -include $(dep)
nuclear@0 40
nuclear@0 41 %.d: %.c
nuclear@0 42 @$(CPP) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@
nuclear@0 43
nuclear@0 44 .PHONY: install
nuclear@0 45 install: $(lib_a) $(lib_so)
nuclear@0 46 mkdir -p $(PREFIX)/lib $(PREFIX)/include/anim
nuclear@0 47 cp $(lib_a) $(PREFIX)/lib/$(lib_a)
nuclear@0 48 cp $(lib_so) $(PREFIX)/lib/$(lib_so)
nuclear@0 49 [ -n "$(solink)" ] && rm -f $(PREFIX)/lib/$(soname) $(PREFIX)/lib/$(solink) \
nuclear@0 50 && ln -s $(PREFIX)/lib/$(lib_so) $(PREFIX)/lib/$(soname) \
nuclear@0 51 && ln -s $(PREFIX)/lib/$(soname) $(PREFIX)/lib/$(solink) \
nuclear@0 52 || true
nuclear@0 53 cp $(hdr) $(PREFIX)/include/anim/
nuclear@0 54
nuclear@0 55 .PHONY: uninstall
nuclear@0 56 uninstall:
nuclear@0 57 rm -f $(PREFIX)/lib/$(lib_a)
nuclear@0 58 rm -f $(PREFIX)/lib/$(lib_so)
nuclear@0 59 rm -f $(PREFIX)/include/anim/*.h
nuclear@0 60 rmdir $(PREFIX)/include/anim
nuclear@0 61
nuclear@0 62 .PHONY: clean
nuclear@0 63 clean:
nuclear@0 64 rm -f $(obj) $(lib_so) $(lib_a)
nuclear@0 65
nuclear@0 66 .PHONY: distclean
nuclear@0 67 distclean: clean
nuclear@0 68 rm -f Makefile