diff --git a/Makefile b/Makefile index 128d1e47c..e8f8d5516 100644 --- a/Makefile +++ b/Makefile @@ -735,10 +735,39 @@ PACKAGE_SEP := - PACKAGE_FULL_NAME := $(PACKAGE_NAME)$(PACKAGE_SEP)$(PACKAGE_LBL) # Source distribution is never dirty because it uses git archive -DIST_NAME := $(DIST_DIR)/$(subst dirty-,,$(PACKAGE_FULL_NAME)).tar +DIST_NAME := $(subst -dirty,,$(PACKAGE_FULL_NAME)) +DIST_TAR := $(DIST_DIR)/$(DIST_NAME).tar +DIST_TAR_GZ := $(DIST_TAR).gz +DIST_VER_INFO := $(DIST_DIR)/version-info.json include $(ROOT_DIR)/package/$(UNAME).mk +############################## +# +# Source for distribution +# +############################## +$(DIST_VER_INFO): .git/index | $(DIST_DIR) + $(V1) $(VERSION_INFO) --jsonpath="$(DIST_DIR)" + +$(DIST_TAR): $(DIST_VER_INFO) .git/index | $(DIST_DIR) + @$(ECHO) " SOURCE FOR DISTRIBUTION $(call toprel, $(DIST_TAR))" + $(V1) git archive --prefix="$(PACKAGE_NAME)/" -o "$(DIST_TAR)" HEAD + $(V1) tar --append --file="$(DIST_TAR)" \ + --transform='s,.*version-info.json,$(PACKAGE_NAME)/version-info.json,' \ + $(call toprel, "$(DIST_VER_INFO)") + +$(DIST_TAR_GZ): $(DIST_TAR) + @$(ECHO) " SOURCE FOR DISTRIBUTION $(call toprel, $(DIST_TAR_GZ))" + $(V1) gzip -kf "$(DIST_TAR)" + +.PHONY: dist_tar_gz +dist_tar_gz: $(DIST_TAR_GZ) + +.PHONY: dist +dist: dist_tar_gz + + ############################## # # Source code formatting @@ -813,30 +842,6 @@ build-info: | $(BUILD_DIR) --template="make/templates/$@.txt" \ --outfile="$(BUILD_DIR)/$@.txt" -############################## -# -# Source for distribution -# -############################## - -DIST_VER_INFO := $(DIST_DIR)/version-info.json - -$(DIST_VER_INFO): .git/index | $(DIST_DIR) - $(V1) $(VERSION_INFO) --jsonpath="$(DIST_DIR)" - - -$(DIST_NAME).gz: $(DIST_VER_INFO) .git/index | $(DIST_DIR) - @$(ECHO) " SOURCE FOR DISTRIBUTION $(call toprel, $(DIST_NAME).gz)" - $(V1) git archive --prefix="$(PACKAGE_NAME)/" -o "$(DIST_NAME)" HEAD - $(V1) tar --append --file="$(DIST_NAME)" \ - --transform='s,.*version-info.json,$(PACKAGE_NAME)/version-info.json,' \ - $(call toprel, "$(DIST_VER_INFO)") - $(V1) gzip -f "$(DIST_NAME)" - -.PHONY: dist -dist: $(DIST_NAME).gz - - ############################## # # Config diff --git a/package/Linux.mk b/package/Linux.mk index 3d61b329e..7acc0455f 100644 --- a/package/Linux.mk +++ b/package/Linux.mk @@ -67,8 +67,8 @@ endif package_src: $(DEB_ORIG_SRC_NAME) $(DEB_PACKAGE_DIR) $(V1) cd $(DEB_PACKAGE_DIR) && dpkg-buildpackage -S -us -uc -$(DEB_ORIG_SRC): $(DIST_NAME).gz | $(PACKAGE_DIR) - $(V1) cp $(DIST_NAME).gz $(DEB_ORIG_SRC) +$(DEB_ORIG_SRC): $(DIST_TAR_GZ) | $(PACKAGE_DIR) + $(V1) cp $(DIST_TAR_GZ) $(DEB_ORIG_SRC) $(DEB_PACKAGE_DIR): $(DEB_ORIG_SRC) debian | $(PACKAGE_DIR) $(V1) tar -xf $(DEB_ORIG_SRC) -C $(PACKAGE_DIR)