Added dependency, cleaned up Makefile

This commit is contained in:
2016-10-28 17:04:26 -05:00
parent e2f6bbd879
commit 83cc058d5c

View File

@@ -8,11 +8,11 @@
# 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 = flex,zlib DEPENDS = flex,glibc,zlib
ARCH = x86_64 ARCH = x86_64
URL = http://www.gnu.org/software/binutils/ URL = http://www.gnu.org/software/binutils/
DESC = The GNU Binutils are a collection of binary tools. DESC = The GNU Binutils are a collection of binary tools.
SNAPVER = sr2 SNAPVER = sr3
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')
@@ -21,13 +21,9 @@ PATCHDIR := $(PWD)/SRC/patches
BUILDDIR := $(PWD)/BUILD BUILDDIR := $(PWD)/BUILD
VERSION := $(shell echo $(SRCDIR)|egrep -o '\-[0-9].*'|sed 's/^-//')$(SNAPVER) VERSION := $(shell echo $(SRCDIR)|egrep -o '\-[0-9].*'|sed 's/^-//')$(SNAPVER)
MAKE = make tooldir=/usr
MAKEINST = make tooldir=/usr install
SNAPHACKS = rm -v $(ROOT)/usr/share/info/dir
include /usr/share/snap/Makefile.snaplinux include /usr/share/snap/Makefile.snaplinux
$(SRCDIR): $(ARCHIVE) $(SRCDIR)/configure: $(ARCHIVE)
@if [ '$(TYPE)' == 'application/x-bzip2' ]; then \ @if [ '$(TYPE)' == 'application/x-bzip2' ]; then \
tar -jxf $(ARCHIVE); \ tar -jxf $(ARCHIVE); \
elif [ '$(TYPE)' == 'application/x-gzip' ]; then \ elif [ '$(TYPE)' == 'application/x-gzip' ]; then \
@@ -40,14 +36,16 @@ $(SRCDIR): $(ARCHIVE)
echo 'Unable to determine archive type'; \ echo 'Unable to determine archive type'; \
exit 1; \ exit 1; \
fi fi
@touch $(SRCDIR)/configure
$(BUILDDIR)/config.log: $(SRCDIR) $(BUILDDIR)/config.log: $(SRCDIR)/configure
@cd $(SRCDIR) && \
for patch in `find $(PATCHDIR) -name \*.patch|sort`; do \
patch --verbose -Np1 -i $$patch; \
done
@if [ ! -d $(BUILDDIR) ]; then \ @if [ ! -d $(BUILDDIR) ]; then \
mkdir -v $(BUILDDIR); \ mkdir -v $(BUILDDIR); \
fi fi
@cd $(SRCDIR) && for patch in `find $(PATCHDIR) -name \*.patch`; do \
patch --verbose -Np0 -i $$patch; \
done
@cd $(BUILDDIR); \ @cd $(BUILDDIR); \
../$(SRCDIR)/configure \ ../$(SRCDIR)/configure \
--prefix=/usr \ --prefix=/usr \
@@ -58,8 +56,7 @@ $(BUILDDIR)/config.log: $(SRCDIR)
--target=x86_64-snap-linux-gnu --target=x86_64-snap-linux-gnu
$(BUILDDIR)/binutils/ar: $(BUILDDIR)/config.log $(BUILDDIR)/binutils/ar: $(BUILDDIR)/config.log
@cd $(BUILDDIR); \ @cd $(BUILDDIR) && make tooldir=/usr
$(MAKE)
$(ROOT): $(BUILDDIR)/binutils/ar $(ROOT): $(BUILDDIR)/binutils/ar
@if [ -d $(ROOT) ]; then \ @if [ -d $(ROOT) ]; then \
@@ -68,10 +65,8 @@ $(ROOT): $(BUILDDIR)/binutils/ar
mkdir -v $(ROOT); \ mkdir -v $(ROOT); \
fi fi
@cd $(BUILDDIR); \ @cd $(BUILDDIR) && make tooldir=/usr install DESTDIR=$(ROOT) && \
$(MAKEINST) DESTDIR=$(ROOT) rm -v $(ROOT)/usr/share/info/dir
@$(SNAPHACKS)
test: $(ROOT) test: $(ROOT)
@cd $(BUILDDIR); \ @cd $(BUILDDIR); \