[zaptel-commits] tzafrir: branch 1.4 r2849 - /branches/1.4/Makefile
SVN commits to the Zaptel project
zaptel-commits at lists.digium.com
Thu Aug 16 08:32:39 CDT 2007
Author: tzafrir
Date: Thu Aug 16 08:32:38 2007
New Revision: 2849
URL: http://svn.digium.com/view/zaptel?view=rev&rev=2849
Log:
Break install target, as in 1.2:
* Provide separate programs and libs targets , and provide separate
install-programs, install-libs , install-includes and install-modules.
* DESTDIR should work. INSTALL_PREFIX was removed, as it was ambigious.
Use the vaiable 'prefix' to override /usr .
* Print a message at the end of the install target.
* Convert shell logic in targets to make logic.
* Still not sure install-libs and install-includes are really needed.
* Use includedir, mandir and libdir (but not sbindir) from configure.
* Install Man pages and utils according to those selected by the user.
Modified:
branches/1.4/Makefile
Modified: branches/1.4/Makefile
URL: http://svn.digium.com/view/zaptel/branches/1.4/Makefile?view=diff&rev=2849&r1=2848&r2=2849
==============================================================================
--- branches/1.4/Makefile (original)
+++ branches/1.4/Makefile Thu Aug 16 08:32:38 2007
@@ -43,7 +43,7 @@
# Set HOTPLUG_FIRMWARE=no to override automatic building with hotplug support
# if it is enabled in the kernel.
ifeq ($(BUILDVER),linux26)
- ifneq (,$(wildcard $(INSTALL_PREFIX)/etc/udev/rules.d))
+ ifneq (,$(wildcard $(DESTDIR)/etc/udev/rules.d))
DYNFS=yes
UDEVRULES=yes
endif
@@ -163,6 +163,8 @@
endif
endif
+SELINUX_COND=[ -x /usr/sbin/sestatus ] && (/usr/sbin/sestatus | grep "SELinux status:" | grep -q "enabled")
+
#
# Features are now configured in zconfig.h
#
@@ -173,12 +175,11 @@
CFLAGS+=-DSTANDALONE_ZAPATA
KMAKE = $(MAKE) -C $(KSRC) SUBDIRS=$(PWD)
KMAKE_INST = $(KMAKE) \
- INSTALL_MOD_PATH=$(INSTALL_PREFIX) INSTALL_MOD_DIR=misc modules_install
+ INSTALL_MOD_PATH=$(DESTDIR) INSTALL_MOD_DIR=misc modules_install
ROOT_PREFIX=
-INSTALL_PREFIX=$(DESTDIR)
-
-CONFIG_FILE=$(INSTALL_PREFIX)/etc/zaptel.conf
+
+CONFIG_FILE=$(DESTDIR)/etc/zaptel.conf
CFLAGS+=-DZAPTEL_CONFIG=\"$(CONFIG_FILE)\"
# sample makefile "trace print"
@@ -223,20 +224,28 @@
LTZ_SO_MAJOR_VER:=1
LTZ_SO_MINOR_VER:=0
-BIN_DIR:=$(INSTALL_PREFIX)/sbin
-LIB_DIR:=$(INSTALL_PREFIX)/usr/lib
-INC_DIR:=$(INSTALL_PREFIX)/usr/include
-MOD_DIR:=$(INSTALL_PREFIX)/lib/modules/$(KVERS)/misc
+# libdir, includedir and mandir are defined in makeopts (from
+# configure).
+# we use /sbin, rather than configure's $(sbindir) because we use /sbin
+# for historical reasons.
+BIN_DIR:=/sbin
+LIB_DIR:=$(libdir)
+INC_DIR:=$(includedir)/zaptel
+MAN_DIR:=$(mandir)/man8
+MOD_DIR:=$(DESTDIR)/lib/modules/$(KVERS)/misc
BINS:=fxotune fxstest sethdlc-new ztcfg ztdiag ztmonitor ztspeed zttest zttool
UTILS:=$(filter-out zttool fxstest ztcfg,$(BINS))
UTILSO:=$(UTILS:%=%.o)
BINS:=$(filter-out $(MENUSELECT_UTILS),$(BINS))
+MAN_PAGES:=$(wildcard $(BINS:%=doc/%.8))
all: menuselect.makeopts
@$(MAKE) _all
-_all: $(if $(BUILD_MODULES),modules) programs $(LTZ_SO) $(LTZ_A)
+_all: $(if $(BUILD_MODULES),modules) programs libs
+
+libs: $(LTZ_SO) $(LTZ_A)
xpp-utils:
ifeq (yes,$(BUILD_XPP))
@@ -415,42 +424,53 @@
$(UTILSO): %.o: %.c
$(CC) $(CFLAGS) -o $@ -c $<
-install: all devices install-modules install-libs install-include install-xpp
-ifeq ($(HOTPLUG_FIRMWARE),yes)
- $(MAKE) -C firmware hotplug-install
-endif
- if [ -f ztcfg ]; then \
- $(INSTALL) -D -m 755 ztcfg $(INSTALL_PREFIX)/sbin/ztcfg; \
- fi
- if [ -f sethdlc-new ]; then \
- $(INSTALL) -D -m 755 sethdlc-new $(INSTALL_PREFIX)/sbin/sethdlc; \
- elif [ -f sethdlc ]; then \
- $(INSTALL) -D -m 755 sethdlc $(INSTALL_PREFIX)/sbin/sethdlc; \
- fi
- if [ -f zttool ]; then \
- $(INSTALL) -D -m 755 zttool $(INSTALL_PREFIX)/sbin/zttool; \
- fi
- $(INSTALL) -m 644 doc/ztcfg.8 $(INSTALL_PREFIX)/usr/share/man/man8
- $(INSTALL) -m 644 doc/zttool.8 $(INSTALL_PREFIX)/usr/share/man/man8
- [ `id -u` = 0 ] && /sbin/depmod -a $(KVERS) || :
- [ -f $(CONFIG_FILE) ] || $(INSTALL) -D -m 644 zaptel.conf.sample $(CONFIG_FILE)
+install: all devices install-modules install-libs firmware
+ @echo "###################################################"
+ @echo "###"
+ @echo "### Zaptel installed successfully."
+ @echo "### If you have not done so before, install init scripts with:"
+ @echo "###"
+ @echo "### make config"
+ @echo "###"
+ @echo "###################################################"
+
+install-programs: programs install-xpp
+ install -d $(DESTDIR)$(BIN_DIR)
+ install $(BINS) $(DESTDIR)$(BIN_DIR)/
+ install -d $(DESTDIR)$(MAN_DIR)
+ install -m 644 $(MAN_PAGES) $(DESTDIR)$(MAN_DIR)/
+ifneq (,$(wildcard $(DESTDIR)$(CONFIG_FILE)))
+ $(INSTALL) -D -m 644 zaptel.conf.sample $(DESTDIR)$(CONFIG_FILE)
+endif
+
+# Pushing those two to a separate target that is not used by default:
+install-modconf:
build_tools/genmodconf $(BUILDVER) "$(ROOT_PREFIX)" "$(filter-out zaptel ztdummy xpp zttranscode ztdynamic,$(BUILD_MODULES)) $(MODULE_ALIASES)"
@if [ -d /etc/modutils ]; then \
/sbin/update-modules ; \
fi
-install-libs: $(LTZ_SO) $(LTZ_A)
- $(INSTALL) -D -m 755 $(LTZ_A) $(LIB_DIR)/$(LTZ_A)
- $(INSTALL) -D -m 755 $(LTZ_SO) $(LIB_DIR)/$(LTZ_SO).$(LTZ_SO_MAJOR_VER).$(LTZ_SO_MINOR_VER)
- if [ -z "$(INSTALL_PREFIX)" -a `id -u` = 0 ]; then \
+firmware:
+ifeq ($(HOTPLUG_FIRMWARE),yes)
+ $(MAKE) -C firmware hotplug-install
+endif
+
+install-libs: libs
+ $(INSTALL) -D -m 755 $(LTZ_A) $(DESTDIR)$(LIB_DIR)/$(LTZ_A)
+ $(INSTALL) -D -m 755 $(LTZ_SO) $(DESTDIR)$(LIB_DIR)/$(LTZ_SO).$(LTZ_SO_MAJOR_VER).$(LTZ_SO_MINOR_VER)
+ifeq (,$(DESTDIR))
+ if [ `id -u` = 0 ]; then \
/sbin/ldconfig || : ;\
fi
- rm -f $(LIB_DIR)$(LTZ_SO)
+endif
+ rm -f $(DESTDIR)$(LIB_DIR)$(LTZ_SO)
$(LN) -sf $(LTZ_SO).$(LTZ_SO_MAJOR_VER).$(LTZ_SO_MINOR_VER) \
- $(LIB_DIR)/$(LTZ_SO).$(LTZ_SO_MAJOR_VER)
+ $(DESTDIR)$(LIB_DIR)/$(LTZ_SO).$(LTZ_SO_MAJOR_VER)
$(LN) -sf $(LTZ_SO).$(LTZ_SO_MAJOR_VER).$(LTZ_SO_MINOR_VER) \
- $(LIB_DIR)/$(LTZ_SO)
- if [ -z "$(INSTALL_PREFIX)" ] && [ -x /usr/sbin/sestatus ] && (/usr/sbin/sestatus | grep "SELinux status:" | grep -q "enabled") ; then /sbin/restorecon -v $(LIB_DIR)/$(LTZ_SO); fi
+ $(DESTDIR)$(LIB_DIR)/$(LTZ_SO)
+ifeq (,$(DESTDIR))
+ if $(SELINUX_COND); then /sbin/restorecon -v $(DESTDIR)$(LIB_DIR)/$(LTZ_SO); fi
+endif
install-xpp:
ifeq (yes,$(BUILD_XPP))
@@ -458,41 +478,36 @@
endif
install-include:
- $(INSTALL) -D -m 644 zaptel.h $(INSTALL_PREFIX)/usr/include/zaptel/zaptel.h
- $(INSTALL) -D -m 644 tonezone.h $(INSTALL_PREFIX)/usr/include/zaptel/tonezone.h
- rm -f $(INSTALL_PREFIX)/usr/include/linux/zaptel.h
- rm -f $(INSTALL_PREFIX)/usr/include/linux/torisa.h
- rm -f $(INSTALL_PREFIX)/usr/include/zaptel.h
- rm -f $(INSTALL_PREFIX)/usr/include/torisa.h
- rm -f $(INSTALL_PREFIX)/usr/include/tonezone.h
+ $(INSTALL) -D -m 644 zaptel.h $(DESTDIR)$(INC_DIR)/zaptel.h
+ $(INSTALL) -D -m 644 tonezone.h $(DESTDIR)$(INC_DIR)/tonezone.h
devices:
ifndef DYNFS
- mkdir -p $(INSTALL_PREFIX)/dev/zap
- rm -f $(INSTALL_PREFIX)/dev/zap/ctl
- rm -f $(INSTALL_PREFIX)/dev/zap/channel
- rm -f $(INSTALL_PREFIX)/dev/zap/pseudo
- rm -f $(INSTALL_PREFIX)/dev/zap/timer
- rm -f $(INSTALL_PREFIX)/dev/zap/transcode
- rm -f $(INSTALL_PREFIX)/dev/zap/253
- rm -f $(INSTALL_PREFIX)/dev/zap/252
- rm -f $(INSTALL_PREFIX)/dev/zap/251
- rm -f $(INSTALL_PREFIX)/dev/zap/250
- mknod $(INSTALL_PREFIX)/dev/zap/ctl c 196 0
- mknod $(INSTALL_PREFIX)/dev/zap/transcode c 196 250
- mknod $(INSTALL_PREFIX)/dev/zap/timer c 196 253
- mknod $(INSTALL_PREFIX)/dev/zap/channel c 196 254
- mknod $(INSTALL_PREFIX)/dev/zap/pseudo c 196 255
+ mkdir -p $(DESTDIR)/dev/zap
+ rm -f $(DESTDIR)/dev/zap/ctl
+ rm -f $(DESTDIR)/dev/zap/channel
+ rm -f $(DESTDIR)/dev/zap/pseudo
+ rm -f $(DESTDIR)/dev/zap/timer
+ rm -f $(DESTDIR)/dev/zap/transcode
+ rm -f $(DESTDIR)/dev/zap/253
+ rm -f $(DESTDIR)/dev/zap/252
+ rm -f $(DESTDIR)/dev/zap/251
+ rm -f $(DESTDIR)/dev/zap/250
+ mknod $(DESTDIR)/dev/zap/ctl c 196 0
+ mknod $(DESTDIR)/dev/zap/transcode c 196 250
+ mknod $(DESTDIR)/dev/zap/timer c 196 253
+ mknod $(DESTDIR)/dev/zap/channel c 196 254
+ mknod $(DESTDIR)/dev/zap/pseudo c 196 255
N=1; \
while [ $$N -lt 250 ]; do \
- rm -f $(INSTALL_PREFIX)/dev/zap/$$N; \
- mknod $(INSTALL_PREFIX)/dev/zap/$$N c 196 $$N; \
+ rm -f $(DESTDIR)/dev/zap/$$N; \
+ mknod $(DESTDIR)/dev/zap/$$N c 196 $$N; \
N=$$[$$N+1]; \
done
else # DYNFS
ifdef UDEVRULES
- install -d $(INSTALL_PREFIX)/etc/udev/rules.d
- build_tools/genudevrules > $(INSTALL_PREFIX)/etc/udev/rules.d/zaptel.rules
+ install -d $(DESTDIR)/etc/udev/rules.d
+ build_tools/genudevrules > $(DESTDIR)/etc/udev/rules.d/zaptel.rules
else # !UDEVRULES
@echo "**** Dynamic filesystem detected -- not creating device nodes"
endif
@@ -500,11 +515,6 @@
install-udev: devices
-# make should *fail* and not silently succeed if a program did not build
-install-programs: $(BINS)
- $(INSTALL) -d $(BIN_DIR)
- $(INSTALL) $(BINS) $(BIN_DIR)
-
uninstall-hotplug:
$(MAKE) -C firmware hotplug-uninstall
@@ -512,22 +522,23 @@
ifeq ($(BUILDVER),linux24)
else
for x in $(ALL_MODULES); do \
- rm -f $(INSTALL_PREFIX)/lib/modules/$(KVERS)/extra/$$x ; \
- rm -f $(INSTALL_PREFIX)/lib/modules/$(KVERS)/misc/$$x ; \
- rm -f $(INSTALL_PREFIX)/lib/modules/$(KVERS)/zaptel/$$x ; \
+ rm -f $(DESTDIR)/lib/modules/$(KVERS)/extra/$$x ; \
+ rm -f $(DESTDIR)/lib/modules/$(KVERS)/misc/$$x ; \
+ rm -f $(DESTDIR)/lib/modules/$(KVERS)/zaptel/$$x ; \
done;
endif
install-modules: $(INSTALL_MODULES) uninstall-modules
ifeq ($(BUILDVER),linux24)
- $(INSTALL) -d $(MOD_DIR)
- $(INSTALL) -m 644 $(INSTALL_MODULES) $(MOD_DIR)
+ $(INSTALL) -d $(DESTDIR)$(MOD_DIR)
+ $(INSTALL) -m 644 $(INSTALL_MODULES) $(DESTDIR)$(MOD_DIR)
else
$(KMAKE_INST)
- if [ -f datamods/syncppp.ko ]; then \
- $(MAKE) -C datamods install; \
- fi
-endif
+ ifneq (,$(wildcard datamods/syncppp.ko))
+ $(MAKE) -C datamods install
+ endif
+endif
+ [ `id -u` = 0 ] && /sbin/depmod -a $(KVERS) || :
config:
ifneq (,$(COPY_INITD))
More information about the zaptel-commits
mailing list