Added dependencies and cleaned up Makefile

This commit is contained in:
2016-10-28 15:29:30 -05:00
parent 7f0ed3b96a
commit 6dddb1daf4

View File

@@ -8,13 +8,13 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
DEPENDS = DEPENDS = glibc,xz,zlib
ARCH = x86_64 ARCH = x86_64
URL = http://git.kernel.org/cgit/utils/kernel/kmod/kmod.git/about/ URL = http://git.kernel.org/cgit/utils/kernel/kmod/kmod.git/about/
DESC = kmod is a set of tools to handle common tasks with Linux kernel \ DESC = kmod is a set of tools to handle common tasks with Linux kernel \
modules like insert, remove, list, check properties, resolve dependencies \ modules like insert, remove, list, check properties, resolve dependencies \
and aliases. and aliases.
SNAPVER = sr0 SNAPVER = sr1
ARCHIVE := $(PWD)/SRC/$(shell ls SRC|egrep '(bz2|gz|tar|xz)$$'|tail -1) ARCHIVE := $(PWD)/SRC/$(shell ls SRC|egrep '(bz2|gz|tar|xz)$$'|tail -1)
TYPE := $(shell file -ib $(ARCHIVE)|cut -d';' -f1|tr -d '\n') TYPE := $(shell file -ib $(ARCHIVE)|cut -d';' -f1|tr -d '\n')
@@ -22,16 +22,6 @@ SRCDIR := $(shell tar -tf $(ARCHIVE)|head -1|sed 's/\/.*//')
PATCHDIR := $(PWD)/SRC/patches PATCHDIR := $(PWD)/SRC/patches
VERSION := $(shell echo $(SRCDIR)|egrep -o '\-[0-9].*'|sed 's/^-//')$(SNAPVER) VERSION := $(shell echo $(SRCDIR)|egrep -o '\-[0-9].*'|sed 's/^-//')$(SNAPVER)
MAKE = make
MAKEINST = make install
SNAPHACKS = install -d -m 755 $(ROOT)/sbin && \
ln -sv ../bin/kmod $(ROOT)/sbin/depmod && \
ln -sv ../bin/kmod $(ROOT)/sbin/insmod && \
ln -sv ../bin/kmod $(ROOT)/sbin/lsmod && \
ln -sv ../bin/kmod $(ROOT)/sbin/modinfo && \
ln -sv ../bin/kmod $(ROOT)/sbin/modprobe && \
ln -sv ../bin/kmod $(ROOT)/sbin/rmmod
include /usr/share/snap/Makefile.snaplinux include /usr/share/snap/Makefile.snaplinux
$(SRCDIR)/configure: $(ARCHIVE) $(SRCDIR)/configure: $(ARCHIVE)
@@ -50,7 +40,8 @@ $(SRCDIR)/configure: $(ARCHIVE)
@touch $(SRCDIR)/configure @touch $(SRCDIR)/configure
$(SRCDIR)/config.log: $(SRCDIR)/configure $(SRCDIR)/config.log: $(SRCDIR)/configure
@cd $(SRCDIR) && for patch in `find $(PATCHDIR) -name \*.patch`; do \ @cd $(SRCDIR) && \
for patch in `find $(PATCHDIR) -name \*.patch|sort`; do \
patch --verbose -Np1 -i $$patch; \ patch --verbose -Np1 -i $$patch; \
done done
@cd $(SRCDIR); \ @cd $(SRCDIR); \
@@ -66,8 +57,7 @@ $(SRCDIR)/config.log: $(SRCDIR)/configure
--target=x86_64-snap-linux-gnu --target=x86_64-snap-linux-gnu
$(SRCDIR)/tools/kmod: $(SRCDIR)/config.log $(SRCDIR)/tools/kmod: $(SRCDIR)/config.log
@cd $(SRCDIR); \ @cd $(SRCDIR) && make
$(MAKE)
$(ROOT): $(SRCDIR)/tools/kmod $(ROOT): $(SRCDIR)/tools/kmod
@if [ -d $(ROOT) ]; then \ @if [ -d $(ROOT) ]; then \
@@ -76,14 +66,14 @@ $(ROOT): $(SRCDIR)/tools/kmod
mkdir -v $(ROOT); \ mkdir -v $(ROOT); \
fi fi
@cd $(SRCDIR); \ @cd $(SRCDIR) && make install DESTDIR=$(ROOT) && \
$(MAKEINST) DESTDIR=$(ROOT) install -v -d -m 755 $(ROOT)/sbin && \
ln -sv ../bin/kmod $(ROOT)/sbin/depmod && \
@$(SNAPHACKS) ln -sv ../bin/kmod $(ROOT)/sbin/insmod && \
ln -sv ../bin/kmod $(ROOT)/sbin/lsmod && \
test: $(ROOT) ln -sv ../bin/kmod $(ROOT)/sbin/modinfo && \
@cd $(SRCDIR); \ ln -sv ../bin/kmod $(ROOT)/sbin/modprobe && \
make test ln -sv ../bin/kmod $(ROOT)/sbin/rmmod
clean: clean:
@rm -rvf $(ROOT) \ @rm -rvf $(ROOT) \