1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
|
#
# Makefile for mol-modules-source, top-level
#
# build the Mac-on-Linux kernel modules from an incomplete source tree
# written by Jens Schmalzing <jensen@debian.org> for the Debian
# package mol-modules-source to allow users to build modules for
# custom kernels, while using a binary package for the rest of the
# emulator.
# Sun, 19 Oct 2003
# define a few variables, in case they are not already set by
# make-kpkg or a higher-level Makefile
KVERS ?= `uname -r`
KSRC ?= /lib/modules/$(KVERS)/build
export KVERS KSRC
INSTALL ?= install
MODDIR ?= $(DESTDIR)/lib/modules/$(KVERS)/misc
export INSTALL MODDIR
# upstream Makefiles and scripts expect the kernel tree here
KERNEL_SOURCE=$(KSRC)
export KERNEL_SOURCE
# module source directories
SUBDIRS = src/kmod src/netdriver
# intermediate module install directory
MOLLIB = mollib
# descend into subdirectories and build modules
.PHONY: $(SUBDIRS)
build: $(SUBDIRS)
$(SUBDIRS):
-$(MAKE) -C $@
# install the modules
install:
$(INSTALL) -d -m 755 -o 0 $(MODDIR)
for file in `find $(MOLLIB) -type f`; do \
$(INSTALL) -m 644 -o 0 $$file $(MODDIR); \
done
# descend into subdirectories and clean up
.PHONY: $(SUBDIRS:=-clean)
clean: $(SUBDIRS:=-clean)
rm -rf $(MOLLIB)
$(SUBDIRS:=-clean):
$(MAKE) -C $(subst -clean,,$@) clean
|