Skip to content

Commit f714f89

Browse files
committed
Merge remote-tracking branch 'origin/github-issue-12' into devel
* Added `make distsrc` target to build tarball with all required source code.
2 parents 46d7061 + c2b2608 commit f714f89

File tree

3 files changed

+28
-4
lines changed

3 files changed

+28
-4
lines changed

CHANGELOG

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
=== 0.5.8 ===
66
* Fixed excessive header installation with proper one.
77
* Fixed installation and deinstallation of shared object and library files.
8+
* Added `make distsrc` target to build tarball with all required source code.
89

910
=== 0.5.7 ===
1011
* Updated makefiles: added `make tree` target.

Makefile

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,11 @@ include $(BASEDIR)/project.mk
3737

3838
# Setup paths
3939
CHK_CONFIG = test -f "$(CONFIG)" || (echo "System not properly configured. Please launch 'make config' first" && exit 1)
40+
DISTSRC_PATH = $(BUILDDIR)/.distsrc
41+
DISTSRC = $(DISTSRC_PATH)/$(ARTIFACT_NAME)
4042

4143
.DEFAULT_GOAL := all
42-
.PHONY: all compile install uninstall depend clean chkconfig
44+
.PHONY: all compile install uninstall depend clean
4345

4446
compile all install uninstall depend:
4547
@$(CHK_CONFIG)
@@ -60,7 +62,7 @@ fetch:
6062

6163
tree:
6264
@echo "Fetching all possible source code dependencies"
63-
@$(MAKE) -s -f "make/modules.mk" $(@) BASEDIR="$(BASEDIR)" CONFIG="$(CONFIG)" TREE="1"
65+
@$(MAKE) -s -f "make/modules.mk" $(@) BASEDIR="$(BASEDIR)" TREE="1"
6466
@echo "Fetch OK"
6567

6668
prune: clean
@@ -71,20 +73,39 @@ prune: clean
7173
@echo "Prune OK"
7274

7375
# Configuration-related targets
74-
.PHONY: config help
76+
.PHONY: config help chkconfig
7577

7678
testconfig:
7779
@$(MAKE) -s -f "$(BASEDIR)/make/configure.mk" $(@) CONFIG="$(CONFIG)" TEST="1" $(MAKEFLAGS)
7880

7981
config:
8082
@$(MAKE) -s -f "$(BASEDIR)/make/configure.mk" $(@) CONFIG="$(CONFIG)" $(MAKEFLAGS)
8183

84+
# Release-related targets
85+
.PHONY: distsrc
86+
distsrc:
87+
@echo "Building source code archive"
88+
@mkdir -p "$(DISTSRC)/modules"
89+
@$(MAKE) -s -f "make/modules.mk" tree BASEDIR="$(BASEDIR)" MODULES="$(DISTSRC)/modules" TREE="1"
90+
@cp -R $(BASEDIR)/include $(BASEDIR)/make $(BASEDIR)/src "$(DISTSRC)/"
91+
@cp $(BASEDIR)/CHANGELOG $(BASEDIR)/COPYING* $(BASEDIR)/Makefile $(BASEDIR)/*.mk "$(DISTSRC)/"
92+
@find "$(DISTSRC)" -iname '.git' | xargs -exec rm -rf {}
93+
@find "$(DISTSRC)" -iname '.gitignore' | xargs -exec rm -rf {}
94+
@tar -C $(DISTSRC_PATH) -czf "$(BUILDDIR)/$(ARTIFACT_NAME)-$(ARTIFACT_VERSION)-src.tar.gz" "$(ARTIFACT_NAME)"
95+
@echo "Created archive: $(BUILDDIR)/$(ARTIFACT_NAME)-$(ARTIFACT_VERSION)-src.tar.gz"
96+
@ln -sf "$(ARTIFACT_NAME)-$(ARTIFACT_VERSION)-src.tar.gz" "$(BUILDDIR)/$(ARTIFACT_NAME)-src.tar.gz"
97+
@echo "Created symlink: $(BUILDDIR)/$(ARTIFACT_NAME)-src.tar.gz"
98+
@rm -rf $(DISTSRC_PATH)
99+
@echo "Build OK"
100+
101+
# Help
82102
help:
83103
@echo "Available targets:"
84104
@echo " all Build all binaries"
85105
@echo " clean Clean all build files and configuration file"
86106
@echo " config Configure build"
87107
@echo " depend Update build dependencies for current project"
108+
@echo " distsrc Make tarball with source code for packagers"
88109
@echo " fetch Fetch all desired source code dependencies from git"
89110
@echo " help Print this help message"
90111
@echo " info Output build configuration"

make/modules.mk

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ BASEDIR := $(CURDIR)
2222
CONFIG := $(CURDIR)/.config.mk
2323

2424
include $(BASEDIR)/dependencies.mk
25-
-include $(CONFIG)
25+
ifneq ($(TREE),1)
26+
include $(CONFIG)
27+
endif
2628
include $(BASEDIR)/project.mk
2729

2830
SYS_DEPENDENCIES = $(DEPENDENCIES) $(TEST_DEPENDENCIES)

0 commit comments

Comments
 (0)