X-Git-Url: http://git.onelab.eu/?p=libnl.git;a=blobdiff_plain;f=lib%2FMakefile;fp=lib%2FMakefile;h=ba5ac6d9456145d1ed29fcc6023829319e2e4c60;hp=0000000000000000000000000000000000000000;hb=4cee2ecb3b8afa0637e6f5fe4c57985a4bc740ff;hpb=2df2fbe518d5a221ce6e3ee88a3fb23fb1b94b27 diff --git a/lib/Makefile b/lib/Makefile new file mode 100644 index 0000000..ba5ac6d --- /dev/null +++ b/lib/Makefile @@ -0,0 +1,76 @@ +# +# lib/Makefile +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation version 2.1 +# of the License. +# +# Copyright (c) 2003-2006 Thomas Graf +# + +ifeq ($(shell [ ! -r ../Makefile.opts ] && echo 1),) + include ../Makefile.opts +endif + +# Core +CIN := $(wildcard *.c) +# NETLINK_ROUTE +CIN += $(wildcard route/*.c) +# Schedulers +CIN += $(wildcard route/sch/*.c) +# Classifiers +CIN += $(wildcard route/cls/*.c) +# fib lookup +CIN += $(wildcard fib_lookup/*.c) + +DEPS := $(CIN:%.c=.deps/%.d) +OBJ := $(CIN:%.c=%.o) +CFLAGS += -fPIC +OUT_SLIB := $(PACKAGE_NAME).so.$(PACKAGE_VERSION) +OUT_AR := $(PACKAGE_NAME).a +LN_SLIB := $(PACKAGE_NAME).so +LN1_SLIB := $(LN_SLIB).1 + +export + +.PHONY: all clean install librtn.a $(OUT_SLIB) + + +all: + @echo " MAKE $(OUT_SLIB)"; \ + $(MAKE) $(OUT_SLIB); \ + $(MAKE) $(OUT_AR) + +$(OUT_SLIB): ../Makefile.opts $(OBJ) + @echo " LD $(OUT_SLIB)"; \ + $(CC) -shared -Wl,-soname,libnl.so.1 -o $(OUT_SLIB) $(OBJ) $(LIBNL_LIB) -lc + @echo " LN $(OUT_SLIB) $(LN1_SLIB)"; \ + rm -f $(LN1_SLIB) ; $(LN) -s $(OUT_SLIB) $(LN1_SLIB) + @echo " LN $(LN1_SLIB) $(LN_SLIB)"; \ + rm -f $(LN_SLIB) ; $(LN) -s $(LN1_SLIB) $(LN_SLIB) + +$(OUT_AR): ../Makefile.opts $(OBJ) + @echo " AR $(OUT_AR)"; \ + $(AR) crus $(OUT_AR) $(OBJ) + +clean: + @echo " CLEAN lib"; \ + $(RM) -f $(OBJ) $(OUT_SLIB) $(LN_SLIB) $(LN1_SLIB); \ + $(RM) -f $(OUT_SLIB) $(LN_SLIB) $(LN1_SLIB) + +distclean: + find .deps -iname \*\.d -exec rm -f '{}' \; + +install: + mkdir -p $(DESTDIR)$(libdir)/ + install -m 0755 $(OUT_SLIB) $(DESTDIR)$(libdir) + install -m 0644 $(OUT_AR) $(DESTDIR)$(libdir) + rm -f $(DESTDIR)$(libdir)/$(LN1_SLIB) + $(LN) -s $(OUT_SLIB) $(DESTDIR)$(libdir)/$(LN1_SLIB) + rm -f $(DESTDIR)$(libdir)/$(LN_SLIB) + $(LN) -s $(LN1_SLIB) $(DESTDIR)$(libdir)/$(LN_SLIB) + +$(DEPS): ../Makefile.opts + +include ../Makefile.rules