Skip to content

Commit

Permalink
update(makefile): add rules for release builds
Browse files Browse the repository at this point in the history
Signed-off-by: Jason Dellaluce <[email protected]>
Co-authored-by: Leonardo Grasso <[email protected]>
  • Loading branch information
2 people authored and poiana committed Jan 17, 2022
1 parent fa68f4c commit 9d7001e
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ ARCH ?=$(shell uname -m)
plugins = $(shell ls -d ${SOURCE_DIR}/*/ | cut -f2 -d'/' | xargs)
plugins-clean = $(addprefix clean/,$(plugins))
plugins-packages = $(addprefix package/,$(plugins))
plugins-releases = $(addprefix release/,$(plugins))

.PHONY: all
all: plugin_info.h $(plugins)
Expand All @@ -50,16 +51,29 @@ $(plugins-clean):
.PHONY: packages
packages: clean/packages $(plugins-clean) $(plugins-packages)

.PHONY: releases
releases: $(plugins-releases)

.PHONY: $(plugins-packages)
$(plugins-packages): all build/utils/version
$(eval PLUGIN_NAME := $(shell basename $@))
$(eval PLUGIN_PATH := plugins/$(PLUGIN_NAME)/lib$(PLUGIN_NAME).so)
$(eval PLUGIN_VERSION := $(shell ./build/utils/version --path $(PLUGIN_PATH) --pre-release | tail -n 1))
echo $(PLUGIN_VERSION)

# re-run command to stop in case of non-zero exit code
@./build/utils/version --path $(PLUGIN_PATH) --pre-release > /dev/null
mkdir -p $(OUTPUT_DIR)/$(PLUGIN_NAME)
cp -r $(PLUGIN_PATH) $(OUTPUT_DIR)/$(PLUGIN_NAME)/
cp -r plugins/$(PLUGIN_NAME)/README.md $(OUTPUT_DIR)/$(PLUGIN_NAME)/
tar -zcvf $(OUTPUT_DIR)/$(PLUGIN_NAME)-$(PLUGIN_VERSION)-${ARCH}.tar.gz -C ${OUTPUT_DIR}/$(PLUGIN_NAME) .

release/%: plugin_info.h clean/% % build/utils/version
$(eval PLUGIN_NAME := $(shell basename $@))
$(eval PLUGIN_PATH := plugins/$(PLUGIN_NAME)/lib$(PLUGIN_NAME).so)
$(eval PLUGIN_VERSION := $(shell ./build/utils/version --path $(PLUGIN_PATH) | tail -n 1))
echo $(PLUGIN_VERSION)
# re-run command to stop in case of non-zero exit code
@./build/utils/version --path $(PLUGIN_PATH) > /dev/null
mkdir -p $(OUTPUT_DIR)/$(PLUGIN_NAME)
cp -r $(PLUGIN_PATH) $(OUTPUT_DIR)/$(PLUGIN_NAME)/
cp -r plugins/$(PLUGIN_NAME)/README.md $(OUTPUT_DIR)/$(PLUGIN_NAME)/
Expand Down

0 comments on commit 9d7001e

Please sign in to comment.