1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
|
Description: Makefile modifications for Debian builds
Add a static library and rearrange some rules to better suit Debian
packaging needs.
Author: Julien BLACHE <jblache@debian.org>
Index: oflib-0git20070620/Makefile
===================================================================
--- oflib-0git20070620.orig/Makefile 2011-01-12 18:25:34.341016001 +0100
+++ oflib-0git20070620/Makefile 2011-06-13 10:19:32.242307929 +0200
@@ -1,27 +1,40 @@
-include_dir=/usr/local/include/ofapi
+include_dir = $(DESTDIR)/usr/include/ofapi
+lib_dir = $(DESTDIR)/usr/lib/$(MULTIARCH_PATH)
LIBNAME = libofapi.so
SONAME = $(LIBNAME).0
SOVERSION = $(SONAME).0.0
+CFLAGS += -g -Wall -O2
+
default:
- gcc -g -Wall -D_REENTRANT -DPIC -fpic -Wl,-soname -Wl,$(SONAME) lib/*.c -shared -o $(SOVERSION)
+ gcc $(CFLAGS) -D_REENTRANT -DPIC -fpic -Wl,-z,relro -Wl,-soname -Wl,$(SONAME) lib/*.c -shared -o $(SOVERSION)
+
+ gcc $(CFLAGS) -c lib/of_externals.c -o lib/of_externals.o
+ gcc $(CFLAGS) -c lib/of_internals.c -o lib/of_internals.o
+ gcc $(CFLAGS) -c lib/of_standard.c -o lib/of_standard.o
+
+ ar cru libofapi.a lib/*.o
+ ranlib libofapi.a
install:
- cp $(SOVERSION) /usr/local/lib
- ln -s /usr/local/lib/$(SOVERSION) /usr/local/lib/$(SONAME)
- ln -s /usr/local/lib/$(SOVERSION) /usr/local/lib/$(LIBNAME)
- test -d "$(include_dir)" || mkdir "$(include_dir)"
+ mkdir -p $(lib_dir)
+ cp $(SOVERSION) $(lib_dir)
+ cp libofapi.a $(lib_dir)
+ ln -sf $(SOVERSION) $(lib_dir)/$(SONAME)
+ ln -sf $(SOVERSION) $(lib_dir)/$(LIBNAME)
+
+ mkdir -p $(include_dir)
cp lib/*.h $(include_dir)
all:
- make default
- make install
- make examples
+ $(MAKE) default
+ $(MAKE) install
+ $(MAKE) examples
examples:
- make -C example/
+ $(MAKE) -C example/
clean:
- make -C example/ clean
- rm -f libofapi.so.*
+ $(MAKE) -C example/ clean
+ rm -f $(SOVERSION) lib/*.o libofapi.a
|