From e785e2688dbae9eebd1c99c48d69b3b3983c25b7 Mon Sep 17 00:00:00 2001 From: tzafrir Date: Tue, 17 Jul 2007 00:13:56 +0000 Subject: * Separate programs, modules install-programs and install-modules targets. * Finish DESTDIR / INSTALL_PREFIX separation. git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.2@2748 5390a7c7-147a-4af0-8ec9-7488f05a26cb --- Makefile | 78 ++++++++++++++++++++++++++++++++++++++-------------------------- 1 file changed, 46 insertions(+), 32 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 5d3f6fa..46eadda 100644 --- a/Makefile +++ b/Makefile @@ -95,7 +95,7 @@ else HOSTCC=gcc -INSTALL_PREFIX := $(DESTDIR) +INSTALL_PREFIX := /usr CFLAGS+=-I. -O4 -g -Wall ifneq (,$(findstring ppc,$(PACHINE))) @@ -122,7 +122,7 @@ KFLAGS+=-DSTANDALONE_ZAPATA KMAKE:= $(MAKE) -C $(KSRC) SUBDIRS=$(PWD) KMAKE_INST:= $(KMAKE) INSTALL_MOD_PATH=$(DESTDIR) INSTALL_MOD_DIR=misc modules_install -CONFIG_FILE:=$(DESTDIR)/etc/zaptel.conf +CONFIG_FILE:=/etc/zaptel.conf CFLAGS+=-DZAPTEL_CONFIG=\"$(CONFIG_FILE)\" ifeq ($(BUILDVER),linux24) @@ -201,13 +201,17 @@ MAN_PAGES_BASE += zttool endif MAN_PAGES = $(MAN_PAGES_BASE:%=doc/%.8) +all: programs modules + +programs: $(BINS) $(LIBTONEZONE_SO) + ifeq ($(BUILDVER),linux24) -all: prereq $(MODULESO) wct4xxp/wct4xxp.o $(BINS) $(LIBTONEZONE_SO) +modules: prereq $(MODULESO) wct4xxp/wct4xxp.o +else +modules: prereq +ifeq (,$(wildcard $(KSRC)/.config)) + @echo "You do not appear to have the sources for the $(KVERS) kernel installed (under $(KSRC))."; exit 1 endif - -ifeq ($(BUILDVER),linux26) -all: prereq $(BINS) $(LIBTONEZONE_SO) - @if [ -z "$(KSRC)" -o ! -d "$(KSRC)" ]; then echo "You do not appear to have the sources for the $(KVERS) kernel installed."; exit 1 ; fi $(MAKE) -C $(KSRC) SUBDIRS=$(PWD) HOTPLUG_FIRMWARE=$(HOTPLUG_FIRMWARE) modules endif @@ -403,20 +407,18 @@ b410p: tar -zxf mISDNuser.tar.gz $(MAKE) -C mISDNuser install -install: all devices firmware - install -D -m 755 ztcfg $(DESTDIR)$(SBINDIR)/ztcfg -ifneq (,$(wildcard sethdlc-new)) - install -D -m 755 sethdlc-new $(DESTDIR)$(SBINDIR)/sethdlc -else - ifneq (,$(wildcard sethdlc)) - install -D -m 755 sethdlc $(DESTDIR)$(SBINDIR)/sethdlc - endif -endif -ifneq (,$(wildcard zttool)) - install -D -m 755 zttool $(DESTDIR)$(SBINDIR)/zttool -endif - install -d $(DESTDIR)$(MANDIR) - install -m 644 $(MAN_PAGES) $(DESTDIR)$(MANDIR) +install: install-modules install-programs + @echo "###################################################" + @echo "###" + @echo "### Zaptel installed successfully." + @echo "### If you have not done so before, install init scripts with:" + @echo "###" + @echo "### make config" + @echo "###" + @echo "###################################################" + +# Specific to a kernel version: +install-modules: modules ifeq ($(BUILDVER),linux26) for x in $(MODULESKO); do \ rm -f $(DESTDIR)/lib/modules/$(KVERS)/extra/$$x ; \ @@ -430,6 +432,23 @@ ifeq (,$(wildcard wcfxsusb.o)) rm -f $(DESTDIR)$(MODS_DIR)/wcfxsusb.o endif rm -f $(DESTDIR)$(MODS_DIR)/wcfxs.o + [ `id -u` = 0 ] && /sbin/depmod -a $(KVERS) || : + +# All the userspace components. Common to all the system: +install-programs: programs devices firmware + install -D -m 755 ztcfg $(DESTDIR)$(SBINDIR)/ztcfg +ifneq (,$(wildcard sethdlc-new)) + install -D -m 755 sethdlc-new $(DESTDIR)$(SBINDIR)/sethdlc +else + ifneq (,$(wildcard sethdlc)) + install -D -m 755 sethdlc $(DESTDIR)$(SBINDIR)/sethdlc + endif +endif +ifneq (,$(wildcard zttool)) + install -D -m 755 zttool $(DESTDIR)$(SBINDIR)/zttool +endif + install -d $(DESTDIR)$(MANDIR) + install -m 644 $(MAN_PAGES) $(DESTDIR)$(MANDIR) install -D -m 755 $(LIBTONEZONE_SO) $(DESTDIR)$(LIBDIR)/$(LIBTONEZONE_SO).$(LIBTONEZONE_SO_MAJOR_VER).$(LIBTONEZONE_SO_MINOR_VER) [ `id -u` = 0 ] && /sbin/ldconfig || : rm -f $(DESTDIR)$(LIBDIR)/$(LIBTONEZONE_SO) @@ -443,20 +462,15 @@ endif install -d $(DESTDIR)$(INCLUDE_DIR)/linux install -m 644 zaptel.h torisa.h $(DESTDIR)$(INCLUDE_DIR)/linux/ install -m 644 tonezone.h $(DESTDIR)$(INCLUDE_DIR) - [ `id -u` = 0 ] && /sbin/depmod -a $(KVERS) || : - [ -f $(CONFIG_FILE) ] || install -D -m 644 zaptel.conf.sample $(CONFIG_FILE) - build_tools/genmodconf $(BUILDVER) "$(INSTALL_PREFIX)" "$(filter-out zaptel ztdummy zttranscode wctc4xxp ztdynamic xpp_usb,$(MODULES)) $(MODULE_ALIASES)" +ifeq (,$(wildcard $(DESTDIR)$(CONFIG_FILE))) + install -D -m 644 zaptel.conf.sample $(DESTDIR)$(CONFIG_FILE) +endif + build_tools/genmodconf $(BUILDVER) "$(DESTDIR)" "$(filter-out zaptel ztdummy zttranscode wctc4xxp ztdynamic xpp_usb,$(MODULES)) $(MODULE_ALIASES)" +ifeq (,$(DESTDIR)) @if [ -d /etc/modutils ]; then \ /sbin/update-modules ; \ fi - @echo "###################################################" - @echo "###" - @echo "### Zaptel installed successfully." - @echo "### If you have not done so before, install init scripts with:" - @echo "###" - @echo "### make config" - @echo "###" - @echo "###################################################" +endif install-udev: devices -- cgit v1.2.3