Skip to content

Instantly share code, notes, and snippets.

@yrcjaya
Last active December 27, 2015 18:09
Show Gist options
  • Save yrcjaya/7367503 to your computer and use it in GitHub Desktop.
Save yrcjaya/7367503 to your computer and use it in GitHub Desktop.
Makefile for Joomla component packaging
COM_NAME = com_helloworld
ARCHIVE_FNAME = archive/$(COM_NAME)_$(shell date +%Y%m%d_%H%M).tar.bz2
.PHONY: package
package: clean
mkdir build
cp -a $(COM_NAME) build/$(COM_NAME)
find build/$(COM_NAME) -type d -not -path build/$(COM_NAME) -exec cp build/$(COM_NAME)/index.html {} \;
cd build/$(COM_NAME);zip -r ../$(COM_NAME).zip . -x \*.swp
rm -rf build/$(COM_NAME)
@echo -e "\n\n# Finished"
@echo "=========="
@echo "Joomla pacakage can be found in ./build directory."
.PHONY: clean
clean:
@echo -e "\n\n# Cleaning up build directory"
@echo "============================="
rm -rf build
.PHONY: archive
archive:
test -d archive || mkdir archive
tar --exclude \*.swp -jcf $(ARCHIVE_FNAME) $(COM_NAME)
@echo -e "\n\nYou can find the tarball at $(ARCHIVE_FNAME)"
.PHONY: help
help:
@echo "Available Targets: "
@echo "package - Create Joomla component package."
@echo "archive - Create backup of component src to archive folder"
@echo "clean - clean build directory"
# Default target is help
.DEFAULT_GOAL := help
# For local user's additional targets
-include local.mk
# Unset DEFAULT GOAL
# .DEFAULT_GOAL :=
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment