mirror of
git://git.code.sf.net/p/xtables-addons/xtables-addons
synced 2025-09-07 13:15:12 +02:00
145 lines
3.8 KiB
Makefile
145 lines
3.8 KiB
Makefile
# -*- Makefile -*-
|
|
|
|
top_srcdir := @top_srcdir@
|
|
srcdir := @srcdir@
|
|
abstop_srcdir := $(shell readlink -f ${top_srcdir})
|
|
abssrcdir := $(shell readlink -f ${srcdir})
|
|
|
|
ifeq (${abstop_srcdir},)
|
|
$(error Path resolution of ${top_srcdir} failed)
|
|
endif
|
|
ifeq (${abssrcdir},)
|
|
$(error Path resolution of ${srcdir} failed)
|
|
endif
|
|
|
|
prefix := @prefix@
|
|
exec_prefix := @exec_prefix@
|
|
libdir := @libdir@
|
|
libexecdir := @libexecdir@
|
|
xtlibdir := @xtlibdir@
|
|
kbuilddir := @kbuilddir@
|
|
|
|
CC := @CC@
|
|
CCLD := ${CC}
|
|
CFLAGS := @CFLAGS@
|
|
LDFLAGS := @LDFLAGS@
|
|
regular_CFLAGS := @regular_CFLAGS@
|
|
kinclude_CFLAGS := @kinclude_CFLAGS@
|
|
xtables_CFLAGS := @xtables_CFLAGS@
|
|
|
|
AM_CFLAGS := ${regular_CFLAGS} -I${top_srcdir}/include ${xtables_CFLAGS} ${kinclude_CFLAGS}
|
|
AM_DEPFLAGS = -Wp,-MMD,$(@D)/.$(@F).d,-MT,$@
|
|
|
|
VU := 0
|
|
am__1verbose_CC_0 = @echo " CC " $@;
|
|
am__1verbose_CCLD_0 = @echo " CCLD " $@;
|
|
am__1verbose_GEN_0 = @echo " GEN " $@;
|
|
am__1verbose_SILENT_0 = @
|
|
am__1verbose_CC_1 = @echo " CC " $@ "<-" $<;
|
|
am__1verbose_CCLD_1 = @echo " CCLD " $@ "<-" $^;
|
|
am__1verbose_GEN_1 = @echo " GEN " $@ "<-" $<;
|
|
am__verbose_CC = ${am__1verbose_CC_${VU}}
|
|
am__verbose_CCLD = ${am__1verbose_CCLD_${VU}}
|
|
am__verbose_GEN = ${am__1verbose_GEN_${VU}}
|
|
am__verbose_SILENT = ${am__1verbose_GEN_${VU}}
|
|
|
|
|
|
#
|
|
# Wildcard module list
|
|
#
|
|
include ${top_srcdir}/mconfig
|
|
-include ${top_srcdir}/mconfig.*
|
|
include ${srcdir}/Mbuild
|
|
-include ${srcdir}/Mbuild.*
|
|
-include ${srcdir}/*.Mbuild
|
|
|
|
|
|
#
|
|
# Building blocks
|
|
#
|
|
targets := $(filter-out %/,${obj-m})
|
|
targets_install := ${targets}
|
|
subdirs_list := $(filter %/,${obj-m})
|
|
|
|
.SECONDARY:
|
|
|
|
.PHONY: all install clean distclean FORCE
|
|
|
|
all: subdirs modules user matches.man targets.man
|
|
|
|
subdirs:
|
|
@for i in ${subdirs_list}; do ${MAKE} -C $$i; done;
|
|
|
|
subdirs-install:
|
|
@for i in ${subdirs_list}; do ${MAKE} -C $$i install; done;
|
|
|
|
user: ${targets}
|
|
|
|
install: modules_install subdirs-install ${targets_install}
|
|
@mkdir -p "${DESTDIR}${xtlibdir}";
|
|
install -pm0755 ${targets_install} "${DESTDIR}${xtlibdir}/";
|
|
|
|
clean: clean_modules
|
|
@for i in ${subdirs_list}; do make -C $$i clean; done;
|
|
rm -f *.oo *.so;
|
|
|
|
distclean: clean
|
|
rm -f .*.d .manpages.lst;
|
|
|
|
-include .*.d
|
|
|
|
|
|
#
|
|
# Call out to kbuild
|
|
#
|
|
.PHONY: modules modules_install clean_modules
|
|
|
|
modules:
|
|
${am__verbose_SILENT}if [ -n "${kbuilddir}" ]; then make -C ${kbuilddir} M=${abssrcdir} XA_TOPSRCDIR=${abstop_srcdir} modules; fi;
|
|
|
|
modules_install:
|
|
${am__verbose_SILENT}if [ -n "${kbuilddir}" ]; then make -C ${kbuilddir} M=${abssrcdir} XA_TOPSRCDIR=${abstop_srcdir} INSTALL_MOD_PATH=${DESTDIR} modules_install; fi;
|
|
|
|
clean_modules:
|
|
${am__verbose_SILENT}if [ -n "${kbuilddir}" ]; then make -C ${kbuilddir} M=${abssrcdir} XA_TOPSRCDIR=${abstop_srcdir} clean; fi;
|
|
|
|
|
|
#
|
|
# Shared libraries
|
|
#
|
|
lib%.so: lib%.oo
|
|
${am__verbose_CCLD}${CCLD} ${AM_LDFLAGS} -shared ${LDFLAGS} -o $@ $<;
|
|
|
|
lib%.oo: ${srcdir}/lib%.c
|
|
${am__verbose_CC}${CC} ${AM_DEPFLAGS} ${AM_CFLAGS} -D_INIT=lib$*_init -DPIC -fPIC ${CFLAGS} -o $@ -c $<;
|
|
|
|
|
|
#
|
|
# Manpages
|
|
#
|
|
wcman_matches := $(wildcard ${srcdir}/libxt_[a-z]*.man)
|
|
wcman_targets := $(wildcard ${srcdir}/libxt_[A-Z]*.man)
|
|
wlist_matches := $(patsubst ${srcdir}/libxt_%.man,%,${wcman_matches})
|
|
wlist_targets := $(patsubst ${srcdir}/libxt_%.man,%,${wcman_targets})
|
|
|
|
.manpages.lst: FORCE
|
|
@echo "${wlist_targets} ${wlist_matches}" >$@.tmp; \
|
|
cmp -s $@ $@.tmp || mv $@.tmp $@; \
|
|
rm -f $@.tmp;
|
|
|
|
man_run = \
|
|
${am__verbose_GEN}for ext in $(1); do \
|
|
f="${srcdir}/libxt_$$ext.man"; \
|
|
if [ -f "$$f" ]; then \
|
|
echo ".SS $$ext"; \
|
|
cat "$$f"; \
|
|
continue; \
|
|
fi; \
|
|
done >$@;
|
|
|
|
matches.man: .manpages.lst ${wcman_matches}
|
|
$(call man_run,${wlist_matches})
|
|
|
|
targets.man: .manpages.lst ${wcman_targets}
|
|
$(call man_run,${wlist_targets})
|