mirror of
https://github.com/engineer-man/piston.git
synced 2025-04-20 20:16:26 +02:00
pkg: massive overhaul
This commit is contained in:
parent
764641b5a6
commit
21c6057130
9 changed files with 168 additions and 112 deletions
30
packages/Makefile
Normal file
30
packages/Makefile
Normal file
|
@ -0,0 +1,30 @@
|
|||
# Wraps all other Makefiles
|
||||
|
||||
# Variables
|
||||
PKG_FILES=$(filter-out common.mk,$(wildcard *.mk))
|
||||
PKG_SLUGS=$(foreach pkg, ${PKG_FILES}, $(addprefix $(shell make -f ${pkg} name)-, $(shell make -f ${pkg} versions)))
|
||||
|
||||
# Functions
|
||||
define pkg_info
|
||||
$(eval PKG_SLUG=$(patsubst $1-%,%,$2))
|
||||
$(eval PKG_PARTS=$(subst -, ,${PKG_SLUG}))
|
||||
$(eval PKG_NAME=$(word 1,${PKG_PARTS}))
|
||||
$(eval PKG_VERSION=$(word 2,${PKG_PARTS}))
|
||||
$(eval PKG_FILE=$(shell grep '^VERSIONS\s*=.*${PKG_VERSION}' $(shell grep "NAME\s*=\s*${PKG_NAME}" ${PKG_FILES} -l) -l))
|
||||
endef
|
||||
|
||||
# Targets
|
||||
|
||||
build: $(foreach pkg, ${PKG_FILES}, $(addprefix build-$(shell make -f ${pkg} name)-, $(lastword $(shell make -f ${pkg} versions))))
|
||||
|
||||
$(addprefix build-, ${PKG_SLUGS}):
|
||||
$(call pkg_info,build,$@)
|
||||
$(MAKE) -f ${PKG_FILE} VERSION=${PKG_VERSION} build
|
||||
|
||||
|
||||
|
||||
clean: $(foreach pkg, ${PKG_FILES}, $(addprefix clean-$(shell make -f ${pkg} name)-, $(shell make -f ${pkg} versions)))
|
||||
rm -rf build/
|
||||
$(addprefix clean-, ${PKG_SLUGS}):
|
||||
$(call pkg_info,clean,$@)
|
||||
$(MAKE) -f ${PKG_FILE} VERSION=${PKG_VERSION} clean
|
Loading…
Add table
Add a link
Reference in a new issue