diff options
-rw-r--r-- | Makefile.opts.in | 2 | ||||
-rw-r--r-- | lib/.gitignore | 1 | ||||
-rw-r--r-- | lib/Makefile | 97 |
3 files changed, 65 insertions, 35 deletions
diff --git a/Makefile.opts.in b/Makefile.opts.in index 4accd85..b68e12f 100644 --- a/Makefile.opts.in +++ b/Makefile.opts.in @@ -16,7 +16,7 @@ CPPFLAGS := @CPPFLAGS@ PACKAGE_NAME := @PACKAGE_NAME@ PACKAGE_VERSION := @PACKAGE_VERSION@ -LIBNL_LIB := @LIBNL_LIB@ +LIBNL_LIB := @LIBNL_LIB@ -lc -L. prefix := @prefix@ exec_prefix := @exec_prefix@ diff --git a/lib/.gitignore b/lib/.gitignore index f4bf2cd..2a450e8 100644 --- a/lib/.gitignore +++ b/lib/.gitignore @@ -1 +1,2 @@ libnl.so* +libnl-*.so* diff --git a/lib/Makefile b/lib/Makefile index b5b166c..cc218a4 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -6,55 +6,84 @@ # License as published by the Free Software Foundation version 2.1 # of the License. # -# Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch> +# Copyright (c) 2003-2008 Thomas Graf <tgraf@suug.ch> # 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) -# Link Info Modules -CIN += $(wildcard route/link/*.c) -# NETLINK_GENERIC -CIN += $(wildcard genl/*.c) -# fib lookup -CIN += $(wildcard fib_lookup/*.c) -# Netfilter -CIN += $(wildcard netfilter/*.c) - -DEPS := $(CIN:%.c=%.d) -OBJ := $(CIN:%.c=%.o) -CFLAGS += -fPIC -OUT_SLIB := $(PACKAGE_NAME).so.$(PACKAGE_VERSION) -LN_SLIB := $(PACKAGE_NAME).so +CORE_C := $(wildcard *.c) +CORE_OBJ := $(CORE_C:%.c=%.o) -export +ROUTE_C := $(wildcard route/*.c) +ROUTE_C += $(wildcard route/cls/*.c) +ROUTE_C += $(wildcard route/sch/*.c) +ROUTE_C += $(wildcard route/link/*.c) +ROUTE_C += $(wildcard fib_lookup/*.c) +ROUTE_OBJ := $(ROUTE_C:%.c=%.o) + +GENL_C := $(wildcard genl/*.c) +GENL_OBJ := $(GENL_C:%.c=%.o) + +NF_C := $(wildcard netfilter/*.c) +NF_OBJ := $(NF_C:%.c=%.o) + +ALL_C := $(CORE_C) $(ROUTE_C) $(GENL_C) $(NF_C) +ALL_OBJ := $(ALL_C:%.c=%.o) +DEPS := $(ALL_C:%.c=%.d) -.PHONY: all clean install librtn.a $(OUT_SLIB) +CFLAGS += -fPIC + +CORE_LIB := $(PACKAGE_NAME).so +ROUTE_LIB := $(PACKAGE_NAME)-route.so +GENL_LIB := $(PACKAGE_NAME)-genl.so +NF_LIB := $(PACKAGE_NAME)-nf.so +LIBS := $(CORE_LIB) $(ROUTE_LIB) $(GENL_LIB) $(NF_LIB) + +export +.PHONY: all clean install $(LIBS) all: - @echo " MAKE $(OUT_SLIB)"; \ - $(MAKE) $(OUT_SLIB) + @echo " MAKE $(LIBS)"; \ + $(MAKE) $(LIBS) + +$(CORE_LIB).$(PACKAGE_VERSION): $(CORE_OBJ) + @echo " LD $@"; \ + $(CC) -shared -Wl,-soname=$@ -o $@ $^ $(LIBNL_LIB) + +$(CORE_LIB): $(CORE_LIB).$(PACKAGE_VERSION) + @echo " LN $@ -> $<"; \ + $(RM) -f $@; $(LN) $< -s $@ + +$(ROUTE_LIB).$(PACKAGE_VERSION): $(ROUTE_OBJ) + @echo " LD $@"; \ + $(CC) -shared -Wl,-soname=$@ -o $@ $^ $(LIBNL_LIB) + +$(ROUTE_LIB): $(ROUTE_LIB).$(PACKAGE_VERSION) + @echo " LN $@ -> $<"; \ + $(RM) -f $@; $(LN) $< -s $@ + +$(GENL_LIB).$(PACKAGE_VERSION): $(GENL_OBJ) + @echo " LD $@"; \ + $(CC) -shared -Wl,-soname=$@ -o $@ $^ $(LIBNL_LIB) + +$(GENL_LIB): $(GENL_LIB).$(PACKAGE_VERSION) + @echo " LN $@ -> $<"; \ + $(RM) -f $@; $(LN) $< -s $@ + +$(NF_LIB).$(PACKAGE_VERSION): $(NF_OBJ) + @echo " LD $@"; \ + $(CC) -shared -Wl,-soname=$@ -o $@ $^ $(LIBNL_LIB) -$(OUT_SLIB): ../Makefile.opts $(OBJ) - @echo " LD $(OUT_SLIB)"; \ - $(CC) -shared -Wl,-soname=libnl.so.1.2 -o $(OUT_SLIB) $(OBJ) $(LIBNL_LIB) -lc - @echo " LN $(LN1_SLIB) $(LN_SLIB)"; \ - $(RM) -f $(LN_SLIB) ; $(LN) -s $(OUT_SLIB) $(LN_SLIB) +$(NF_LIB): $(NF_LIB).$(PACKAGE_VERSION) + @echo " LN $@ -> $<"; \ + $(RM) -f $@; $(LN) $< -s $@ clean: @echo " CLEAN lib"; \ - $(RM) -f $(OBJ) $(OUT_SLIB) $(LN_SLIB) $(LN1_SLIB); \ - $(RM) -f $(DEPS) $(OUT_SLIB) $(LN_SLIB) $(LN1_SLIB) + $(RM) -f $(ALL_OBJ) $(LIBS) $(DEPS) distclean: @echo " DISTCLEAN lib"; \ |