1makefile: fix compilation and installation 2 3This was originally taken from: 4https://sources.debian.org/data/main/liba/libavl/0.3.5-4/debian/patches/fix-makefile 5 6Unfortunately, the URL does not end in ".patch", therefore we cannot 7use it in the FOO_PATCH variable directly. 8 9Signed-off-by: Michael Walle <michael@walle.cc> 10 11--- a/GNUmakefile 12+++ b/GNUmakefile 13@@ -6,7 +6,8 @@ 14 LDCONFIG ?= /sbin/ldconfig 15 16 # Some suggestions: (-mcpu= generates i386 compatible code) 17-CFLAGS ?= -O2 -fomit-frame-pointer -pipe -mcpu=i686 -w 18+CFLAGS ?= -O2 -pipe -Wall -Werror 19+CFLAGS += -fPIC 20 #CFLAGS = -O2 -fomit-frame-pointer -pipe -march=i586 -Wall -g 21 #CFLAGS = -O6 -fomit-frame-pointer -pipe -march=i586 -Wall -ansi -pedantic 22 #CFLAGS = -O6 -fomit-frame-pointer -pipe -march=i686 -Wall -ansi -pedantic 23@@ -34,20 +35,21 @@ 24 $(CC) $(LDFLAGS) $^ -o $@ $(LIBS) 25 26 $(LIBRARY): avl.o 27- $(CC) -nostdlib -shared -Wl,-soname,libavl.so.1 $^ -o $@ -lc 28+ $(CC) $(LDFLAGS) -shared -Wl,-soname,libavl.so.1 $^ -o $@ -lc 29 30 clean: 31 $(RM) *.o $(PROGRAMS) libavl.* 32 33 install: all 34 $(INSTALL) -d $(DESTDIR)$(libdir) 35- $(INSTALL) avl.h $(DESTDIR)$(includedir) 36- $(INSTALL) $(LIBRARIES) $(DESTDIR)$(libdir) 37- for i in $(LIBRARIES); do\ 38+ $(INSTALL) -d $(DESTDIR)$(includedir) 39+ $(INSTALL) -m 644 avl.h $(DESTDIR)$(includedir) 40+ $(INSTALL) -m 644 $(LIBRARY) $(DESTDIR)$(libdir) 41+ for i in $(LIBRARY); do\ 42 $(LN) -sf $$i $(DESTDIR)$(libdir)/$${i%.*};\ 43 $(LN) -sf $${i%.*} $(DESTDIR)$(libdir)/$${i%.*.*};\ 44 done 45- -$(LDCONFIG) 46+ #-$(LDCONFIG) 47 48 .PHONY: clean install all 49 .PRECIOUS: %.h %.c 50