Makefile for PowerShell modules added.
It allows to (re)build .zip file from module sources. This .zip file will be used in image builder later. Change-Id: Ia07bc531143be8bc65fd04ceb715f5da285b43d5
This commit is contained in:
parent
cf11cfd347
commit
264d8931c8
|
@ -0,0 +1,69 @@
|
|||
|
||||
.PHONY : all
|
||||
.PHONY : force
|
||||
.PHONY : usage
|
||||
.PHONY : module-list
|
||||
|
||||
|
||||
module_dir := Modules
|
||||
module_list := $(shell find Modules -maxdepth 1 -type d -printf "%P ")
|
||||
module_name :=
|
||||
|
||||
|
||||
usage :
|
||||
@echo "Available targets:"
|
||||
@echo "* all - make all modules"
|
||||
@echo "* module-list - lists all modules under '${module_dir}'"
|
||||
@echo "* <module name> - build module named <module name>"
|
||||
|
||||
|
||||
module-list :
|
||||
@echo "Available modules:"
|
||||
@for name in ${module_list} ; do \
|
||||
echo "* $$name"; \
|
||||
done
|
||||
@echo ""
|
||||
|
||||
|
||||
ifndef module_name
|
||||
|
||||
all : ${module_list}
|
||||
|
||||
|
||||
${module_list} :
|
||||
@echo ''
|
||||
@echo 'Calling make recurcievely ...'
|
||||
$(MAKE) -e module_name=$@ $@
|
||||
|
||||
else
|
||||
|
||||
${module_name} : ${module_name}.zip
|
||||
|
||||
|
||||
${module_name}.zip : ${module_dir}/${module_name}.content
|
||||
@echo ''
|
||||
@echo "Zipping module '${module_name}' ..."
|
||||
-rm -f $@
|
||||
cd ${module_dir} && zip -r $@ ${module_name}
|
||||
mv ${module_dir}/$@ ${CURDIR}
|
||||
|
||||
|
||||
${module_dir}/${module_name}.content : force
|
||||
@echo ""
|
||||
@echo "Generating file list for module '${module_name}' ..."
|
||||
cd ${module_dir} && find ${module_name} > $(@F).tmp
|
||||
[ -f $@ ] || cp $@.tmp $@
|
||||
cmp -s $@ $@.tmp || cp $@.tmp $@
|
||||
rm $@.tmp
|
||||
|
||||
endif
|
||||
|
||||
|
||||
clean :
|
||||
@echo ''
|
||||
@echo 'Cleaning temporary files ...'
|
||||
rm -f ${module_dir}/*.content
|
||||
rm -f ${module_dir}/*.content.tmp
|
||||
rm -f *.zip
|
||||
|
||||
|
|
@ -5,6 +5,13 @@ This folder contains PowerShell modules and scripts that will be executed on an
|
|||
|
||||
Windows PowerShell module is a convenient way to redictribute a set of PowerShell scripts.
|
||||
|
||||
|
||||
Makefile
|
||||
========
|
||||
|
||||
Use 'make' to (re)build .zip package of PowerShell module.
|
||||
|
||||
|
||||
SEE ALSO
|
||||
========
|
||||
* `Murano <http://murano.mirantis.com>`__
|
||||
|
|
Loading…
Reference in New Issue