Skip to content

Commit

Permalink
Use generic makefiles.
Browse files Browse the repository at this point in the history
  • Loading branch information
Hylen committed Aug 9, 2020
1 parent 17b6cae commit 1d1e683
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 82 deletions.
89 changes: 7 additions & 82 deletions mk/spksrc.cross-rust.mk
Original file line number Diff line number Diff line change
Expand Up @@ -118,35 +118,7 @@ rust_build_and_install_target:

#####

ifneq ($(REQ_KERNEL),)
@$(error rust modules cannot build when REQ_KERNEL is set)
endif

# Check if package supports ARCH
ifneq ($(UNSUPPORTED_ARCHS),)
ifneq (,$(findstring $(ARCH),$(UNSUPPORTED_ARCHS)))
@$(error Arch '$(ARCH)' is not a supported architecture )
endif
endif

# Check minimum DSM requirements of package
ifneq ($(REQUIRED_DSM),)
ifeq (,$(findstring $(ARCH),$(SRM_ARCHS)))
ifneq ($(REQUIRED_DSM),$(firstword $(sort $(TCVERSION) $(REQUIRED_DSM))))
@$(error DSM Toolchain $(TCVERSION) is lower than required version in Makefile $(REQUIRED_DSM))
endif
endif
endif
# Check minimum SRM requirements of package
ifneq ($(REQUIRED_SRM),)
ifeq ($(ARCH),$(findstring $(ARCH),$(SRM_ARCHS)))
ifneq ($(REQUIRED_SRM),$(firstword $(sort $(TCVERSION) $(REQUIRED_SRM))))
@$(error SRM Toolchain $(TCVERSION) is lower than required version in Makefile $(REQUIRED_SRM))
endif
endif
endif

#####
include ../../mk/spksrc.pre-check.mk

include ../../mk/spksrc.cross-env.mk

Expand All @@ -172,22 +144,8 @@ include ../../mk/spksrc.compile.mk
install: compile
include ../../mk/spksrc.install.mk

ifeq ($(strip $(PLIST_TRANSFORM)),)
PLIST_TRANSFORM= cat
endif

.PHONY: cat_PLIST
cat_PLIST:
@for depend in $(DEPENDS) ; \
do \
$(MAKE) WORK_DIR=$(WORK_DIR) --no-print-directory -C ../../$$depend cat_PLIST ; \
done
@if [ -f PLIST ] ; \
then \
$(PLIST_TRANSFORM) PLIST ; \
else \
$(MSG) "No PLIST for $(NAME)" >&2; \
fi
plist: install
include ../../mk/spksrc.plist.mk

### Clean rules
smart-clean:
Expand All @@ -197,32 +155,11 @@ smart-clean:
clean:
rm -fr work work-*


all: install

sha1sum := $(shell which sha1sum 2>/dev/null || which gsha1sum 2>/dev/null)
sha256sum := $(shell which sha256sum 2>/dev/null || which gsha256sum 2>/dev/null)
md5sum := $(shell which md5sum 2>/dev/null || which gmd5sum 2>/dev/null || which md5 2>/dev/null)

.PHONY: $(DIGESTS_FILE)
$(DIGESTS_FILE): download
@$(MSG) "Generating digests for $(PKG_NAME)"
@rm -f $@ && touch -f $@
@for type in SHA1 SHA256 MD5; do \
case $$type in \
SHA1) tool=${sha1sum} ;; \
SHA256) tool=${sha256sum} ;; \
MD5) tool=${md5sum} ;; \
esac ; \
echo "$(LOCAL_FILE) $$type `$$tool $(DIST_FILE) | cut -d\" \" -f1`" >> $@ ; \
done

dependency-tree:
@echo `perl -e 'print "\\\t" x $(MAKELEVEL),"\n"'`+ $(NAME) $(PKG_VERS)
@for depend in $(BUILD_DEPENDS) $(DEPENDS) ; \
do \
$(MAKE) --no-print-directory -C ../../$$depend dependency-tree ; \
done
include ../../mk/spksrc.generate-digests.mk

include ../../mk/spksrc.dependency-tree.mk

.PHONY: all-archs
all-archs: $(addprefix arch-,$(AVAILABLE_ARCHS))
Expand All @@ -231,16 +168,4 @@ arch-%:
@$(MSG) Building package for arch $*
-@MAKEFLAGS= $(MAKE) ARCH=$(basename $(subst -,.,$(basename $(subst .,,$*)))) TCVERSION=$(if $(findstring $*,$(basename $(subst -,.,$(basename $(subst .,,$*))))),$(DEFAULT_TC),$(notdir $(subst -,/,$*)))

.PHONY: kernel-required
kernel-required:
@if [ -n "$(REQ_KERNEL)" ]; then \
exit 1 ; \
fi
@for depend in $(BUILD_DEPENDS) $(DEPENDS) ; do \
if $(MAKE) --no-print-directory -C ../../$$depend kernel-required >/dev/null 2>&1 ; then \
exit 0 ; \
else \
exit 1 ; \
fi ; \
done

include ../../mk/spksrc.kernel-required.mk
4 changes: 4 additions & 0 deletions mk/spksrc.generate-digests.mk
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
# include this file after the rule "all:"
#

sha1sum := $(shell which sha1sum 2>/dev/null || which gsha1sum 2>/dev/null)
sha256sum := $(shell which sha256sum 2>/dev/null || which gsha256sum 2>/dev/null)
md5sum := $(shell which md5sum 2>/dev/null || which gmd5sum 2>/dev/null || which md5 2>/dev/null)

$(DIGESTS_FILE): download
@$(MSG) "Generating digests for $(NAME)"
@rm -f $@ && touch -f $@
Expand Down

0 comments on commit 1d1e683

Please sign in to comment.