"Fossies" - the Fresh Open Source Software Archive

Member "aoe-aoe6-86/Makefile" (4 Jul 2015, 5522 Bytes) of archive /linux/misc/aoe-aoe6-86.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "Makefile": 85_vs_86.

    1 # makefile for out-of-kernel AoE build
    2 # uses pre-configured 2.6 kernel sources
    3 # 
    4 
    5 .PHONY: copy default tools clean realclean realrealclean \
    6   install install_modobj install_nodev kerninst uninstall report
    7 
    8 # export all directives to sub makes (aoetools)
    9 export
   10 
   11 # where the aoe-stat, aoe-discover, etc. commands will go
   12 SBINDIR = /usr/sbin
   13 MANDIR = /usr/share/man
   14 
   15 # the directory in /dev to place device nodes
   16 #DEVSUBDIR=
   17 DEVSUBDIR=etherd
   18 
   19 # where the devices nodes will be created
   20 DEVDIR=/dev/$(DEVSUBDIR)
   21 
   22 # number of shelves for which dev nodes are created
   23 # (numbering starts at 0)
   24 N_DEV_SHELVES=10
   25 
   26 DYNDEVS := $(shell conf/detect-udev)
   27 
   28 # number of slots per shelf for static minor device node numbers
   29 NPERSHELF=16
   30 
   31 # the number of partitions supported per device; default is 16
   32 # (set to 1 for greater compatibility on systems with poor support
   33 #  for large minor device numbers)
   34 AOE_PARTITIONS=16
   35 
   36 DRIVER_D = linux/drivers/block/aoe
   37 SCRIPTS_D = linux/Documentation/aoe
   38 TOOLS_D = aoetools-36
   39 
   40 # Get the kernel version
   41 KVER := $(shell uname -r)
   42 
   43 # kernel sources for building third-party modules should be found here
   44 KDIR := /lib/modules/$(KVER)/build
   45 
   46 # INSTDIR is where to put the aoe module
   47 INSTDIR := /lib/modules/$(KVER)/kernel/drivers/block/aoe
   48 
   49 PWD	:= $(shell pwd)
   50 EXTRA_CFLAGS := -DAOE_PARTITIONS=$(AOE_PARTITIONS) -DDEVSUBDIR='\"${DEVSUBDIR}\"'
   51 EXTRA_CFLAGS += -DAOE_DYNDEVS=${DYNDEVS}
   52 KMAK_FLAGS := \
   53 	  CONFIG_ATA_OVER_ETH=m \
   54 	  KDIR=${KDIR}
   55 
   56 DUMMY := $(shell sh mak/cc-id.sh ${MAKE} -C $(KDIR) $(KMAK_FLAGS) SUBDIRS="$(PWD)/mak" modules)
   57 DUMMY := $(shell sh mak/kernel-id.sh ${KDIR})
   58 DUMMY := $(shell sh mak/src-id.sh ${DRIVER_D})
   59 
   60 COPY_DIR = $(HOME)/build/aoe
   61 
   62 default: tools ${DRIVER_D}/aoe.ko
   63 
   64 ${DRIVER_D}/aoe.ko : conf/done mak/src-id.ts
   65 	$(MAKE) -C $(KDIR) $(KMAK_FLAGS) SUBDIRS="$(PWD)/$(DRIVER_D)" EXTRA_CFLAGS="${EXTRA_CFLAGS}" modules
   66 	@if test "${DYNDEVS}" = "1"; then \
   67 		echo "This aoe driver uses dynamic minor device numbers."; \
   68 	else \
   69 		echo "This aoe driver uses static minor device numbers."; \
   70 	fi
   71 
   72 # sanity checks and handling of compile-time resolvable compatibility issues
   73 conf/done : mak/cc-id.ts mak/kernel-id.ts
   74 	@perl -e '' || { \
   75 	  echo "Error: the build system depends on perl being available" 1>&2; \
   76 	  false; \
   77 	}
   78 	sh -c "cd $(DRIVER_D) && rm -f *.o *.ko core"
   79 	@test -r "$(KDIR)/.config" || { \
   80 	  echo "Error: $(KDIR) sources are not configured." 1>&2; \
   81 	  false; \
   82 	}
   83 	@if ! test -r "$(KDIR)/include/asm" && \
   84 	  ! test -r "$(KDIR)/include/generated/autoconf.h"; then \
   85 	  echo "Error: $(KDIR) sources are not prepared." 1>&2; \
   86 	  false; \
   87 	fi
   88 	@if ! test -r "$(KDIR)/scripts/mod/modpost"; then \
   89 	  echo "Error: $(KDIR) scripts are not present." 1>&2; \
   90 	  echo "  try running 'make scripts' in $(KDIR)" 1>&2; \
   91 	  false; \
   92 	fi
   93 	@printf "ensuring compatibility ... "
   94 	@cd conf && rm -rf *.o *.ko .tmp_versions .*.*o.cmd .*.*o.d *.mod.c
   95 	@sh conf/compat.sh $(DRIVER_D) \
   96 	  $(MAKE) -C $(KDIR) $(KMAK_FLAGS) SUBDIRS="$(PWD)/conf" C=0 modules
   97 	echo > conf/done
   98 	@sh mak/src-id.sh ${DRIVER_D}
   99 
  100 copy:
  101 	@cpio -p `pwd` < /dev/null 2>&0 || { \
  102 	  echo Error: cpio is required for copy target 1>&2; \
  103 	  exit 1; \
  104 	}
  105 	mkdir -p $(COPY_DIR)
  106 	find . -name .git -type d -prune -o -print | cpio -p --verbose $(COPY_DIR)
  107 
  108 tools:
  109 	cd ${TOOLS_D} && make 
  110 clean:
  111 	rm -f kv.mak conf/kdir.last
  112 	cd $(DRIVER_D) && rm -f *.o *.ko core
  113 	cd conf && rm -rf *.o *.ko .tmp_versions .*.*o.cmd .*.*o.d *.mod.c
  114 	cd ${TOOLS_D} && make clean
  115 
  116 realclean: clean
  117 	rm -f conf/make.log
  118 	cd $(DRIVER_D) && rm -rf .tmp_versions .aoe*.*o.cmd .aoe*.*o.d aoe.mod.c
  119 	cd $(DRIVER_D) && rm -rf Module.symvers
  120 	cd conf && rm -f *.log Makefile
  121 
  122 # revert conf patches
  123 realrealclean: realclean
  124 	-sh conf/compat.sh -R $(DRIVER_D) \
  125 	  $(MAKE) -C $(KDIR) $(KMAK_FLAGS) SUBDIRS="$(PWD)/conf" modules
  126 	cd $(DRIVER_D) && rm -rf *.orig *.rej
  127 
  128 install_modobj: default
  129 	@echo "Install directory is $(INSTDIR)"
  130 	mkdir -p $(INSTDIR)
  131 	install -m 644 $(DRIVER_D)/aoe.ko $(INSTDIR)
  132 	/sbin/depmod -a
  133 
  134 install_nodev: install_modobj
  135 # punt if DEVSUBDIR isn't the default.  probably should have cleaner solution.
  136 	@if test -r /etc/udev/udev.conf; then \
  137 	  if test "$(DEVSUBDIR)" != "etherd" || \
  138 	  ! conf=/etc/udev/udev.conf sh $(SCRIPTS_D)/udev-install.sh; then \
  139 	    (echo ; echo "!! DID NOT INSTALL UDEV RULES FOR AOE"; echo) 1>&2; \
  140 	  fi; \
  141 	fi
  142 	cd ${TOOLS_D} && make install
  143 install: install_nodev
  144 	@if test "${DYNDEVS}" = "0"; then \
  145 		echo "creating static device nodes in ${DEVDIR}"; \
  146 		n_partitions=$(AOE_PARTITIONS) \
  147 		  n_shelves=${N_DEV_SHELVES} ${TOOLS_D}/aoe-mkdevs $(DEVDIR); \
  148 	fi
  149 
  150 # experts can put the driver in a kernel source tree with
  151 # "make kerninst"
  152 kerninst: conf/done mak/src-id.ts
  153 	test -d ${KDIR}/drivers/block/aoe
  154 	cp -b ${DRIVER_D}/*.[ch] ${KDIR}/drivers/block/aoe
  155 	echo "#define AOE_PARTITIONS (${AOE_PARTITIONS})" \
  156 	  >> ${KDIR}/drivers/block/aoe/aoe.h
  157 	echo '#define DEVSUBDIR "${DEVSUBDIR}"' \
  158 	  >> ${KDIR}/drivers/block/aoe/aoe.h
  159 	echo '#define AOE_DYNDEVS (${DYNDEVS})' \
  160 	  >> ${KDIR}/drivers/block/aoe/aoe.h
  161 	echo 'aoe-objs += aoedbg.o' \
  162 	  >> ${KDIR}/drivers/block/aoe/Makefile
  163 
  164 uninstall:
  165 	@echo "Removing Module from $(INSTDIR)"
  166 	rm -f $(INSTDIR)/aoe.ko
  167 	@echo "Removing $(DEVDIR) and components"
  168 	rm -rf $(DEVDIR)
  169 	/sbin/depmod -a
  170 
  171 REPORTF := $(shell awk '$$2=="VERSION"{print $$NF}' ${DRIVER_D}/aoe.h)
  172 # remove quotes below
  173 REPORTF := $(shell echo aoe6-${REPORTF}-report.tar)
  174 
  175 report:
  176 	tar cf ${REPORTF} conf/*.log
  177 	gzip ${REPORTF}
  178 	@echo The report file is "${REPORTF}.gz".