# Common GNU Make definitions useful for multiple Makefiles ECLIPSE=$(foreach file,\ /opt/ti/ccsv5/eclipse/eclipse \ C:/ti/ccsv5/eclipse/eclipsec.exe,\ $(if $(wildcard $(file)),$(file))) ifeq ($(OS),Windows_NT) TMP_WORKSPACE=$(TEMP)/_workspace else TMP_WORKSPACE:=$(shell mktemp --dry-run --tmpdir -d rpp-test-sw-workspace.XXXXXXXXXX) endif ifeq ($(OS),Windows_NT) pathconv=$(subst /,\,$1) mkdir=-mkdir $(subst /,\,$1) rm=-del /Q $(call pathconv,$1) rmdir=-rmdir /S /Q $(call pathconv,$1) cp=copy $(subst /,\,$1) $(subst /,\,$2) # Always use cmd.exe, ignore sh.exe if there is one SHELL=cmd.exe else pathconv=$1 mkdir=mkdir -p $1 rm=rm -rf $1 rmdir=-rm -rf $1 cp=cp $1 $2 endif # Usage: $(call release_rules,) define release_rules RELEASE_COMMIT = HEAD RELEASE_PREFIX = $(1) $$(if $$(RELEASE_PREFIX),,$$(error Call release_rules with prefix as an argument)) ifneq ($(OS),Windows_NT) RELEASE_VERSION := $$(shell git describe --always $$(RELEASE_COMMIT)|sed -e "s/^[-a-zA-Z_]*//") endif RELEASE_BASENAME = $$(RELEASE_PREFIX)-$$(RELEASE_VERSION) .PHONY: $$(RELEASE_BASENAME).zip $$(RELEASE_BASENAME).zip: rm -rf $$@ $$(RELEASE_BASENAME) $(MAKE) $$(RELEASE_BASENAME) zip -r $$@ $$(RELEASE_BASENAME) $$(RELEASE_BASENAME):: git archive --worktree-attributes --prefix=$$@/ $$(RELEASE_COMMIT) | tar xf - print-release-basename: @echo $$(RELEASE_BASENAME) endef