Skip to content

Commit

Permalink
Refactor top-level make system to be more stable
Browse files Browse the repository at this point in the history
  • Loading branch information
aiobofh committed Aug 17, 2017
1 parent faa2951 commit ccfae0c
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 29 deletions.
68 changes: 42 additions & 26 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,59 +2,75 @@
# Makefile to build releases of CUTest
#

export COVERAGE=0
VERSION=$(shell grep 'CUTEST_VERSION' src/cutest.h | cut -d'"' -f2)

all:
@echo "========================" && \
echo "Running regression tests" && \
echo "========================" && \
make -s regression_tests && \
make -s README.rst && \
make -s clean && \
make -s release
echo "" && \
$(MAKE) -r --no-print-directory regression_tests && \
$(MAKE) -r --no-print-directory README.rst && \
$(MAKE) -r --no-print-directory clean && \
$(MAKE) -r --no-print-directory release

regression_tests:
make -s -C examples && \
make -s -C examples/complex_directory_structure/my_project_with_a_test_folder_inside_the_src_folder/src && \
make -s -C examples/complex_directory_structure/my_project_with_separate_src_and_test_folders
@echo "examples:" && \
$(MAKE) -r --no-print-directory -C examples && echo "OK" && \
echo "my_project_with_a_test_folder_inside_the_src_folder:" && \
$(MAKE) -r --no-print-directory -C examples/complex_directory_structure/my_project_with_a_test_folder_inside_the_src_folder/src && echo "OK" && \
echo "my_project_with_separate_src_and_test_folders:" && \
$(MAKE) -r --no-print-directory -C examples/complex_directory_structure/my_project_with_separate_src_and_test_folders && echo "OK" && \
echo ""

release: cutest-$(VERSION).tar.gz

cutest-$(VERSION).tar.gz:
@echo "Checking git repository for version tag v$(VERSION)" && \
@echo "==============================================" && \
echo "Checking git repository for version tag v$(VERSION)" && \
echo "==============================================" && \
echo "" && \
git tag -l | grep "v$(VERSION)" && echo "Version v$(VERSION) is already released" && \
git tag -l | grep "v$(VERSION)" && exit 1 || \
echo "OK, version not found... Creating release" && \
echo "OK" && \
echo "" && \
echo "=================" && \
echo "Creating tar-ball" && \
echo "=================" && \
echo "" && \
mkdir cutest-$(VERSION) && \
cp -r LICENSE examples src cutest-$(VERSION)/. && \
rm -rf cutest-$(VERSION)/.git* && \
rm -rf cutest-$(VERSION)/Makefile && \
tar -c cutest-$(VERSION) | gzip > $@ && \
rm -rf cutest-$(VERSION) && \
mkdir tmp && \
cp cutest-$(VERSION).tar.gz tmp/. && \
cd tmp && \
tar -xzf cutest-$(VERSION).tar.gz && \
cd cutest-$(VERSION) && \
cp ../../Makefile . && \
echo "OK" && \
echo "" && \
tar -xzf cutest-$(VERSION).tar.gz && cp Makefile cutest-$(VERSION)/. && \
echo "========================" && \
echo "Testing tar-ball" && \
echo "========================" && \
make -s regression_tests && \
cd ../../ && \
rm -rf tmp && \
echo "" && \
$(MAKE) -r --no-print-directory -C cutest-$(VERSION) regression_tests && \
rm -rf cutest-$(VERSION) && \
echo "" && \
echo "ALL OK!!! Go ahead and upload the cutest-$(VERSION).tar.gz then inform the public!" && \
echo ""

README.rst:
@cd examples && \
make -s cutest_help.rst && \
mv cutest_help.rst ../$@ && \
make -s clean
examples/cutest_help.rst:
@$(MAKE) -r --no-print-directory -C examples cutest_help.rst

README.rst: examples/cutest_help.rst
@echo "=============================="; \
echo "Generating new README.rst file"; \
echo "=============================="; \
echo "" && \
mv $^ $@ && echo "OK" && \
$(MAKE) -r --no-print-directory -C examples clean && \
echo ""
clean:
@rm -rf tmp cutest-* *~ && \
make -s -C examples clean && \
make -s -C examples/complex_directory_structure/my_project_with_a_test_folder_inside_the_src_folder/src clean && \
make -s -C examples/complex_directory_structure/my_project_with_separate_src_and_test_folders clean
$(MAKE) -r --no-print-directory -C examples clean && \
$(MAKE) -r --no-print-directory -C examples/complex_directory_structure/my_project_with_a_test_folder_inside_the_src_folder/src clean && \
$(MAKE) -r --no-print-directory -C examples/complex_directory_structure/my_project_with_separate_src_and_test_folders clean
4 changes: 4 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ naive, simple and realistic examples of various CUTest usages.
Version history
---------------

* v1.0.2 yyyy-mm-dd Release work flow enhancements

- Fixed the documentation generator to be run before release

* v1.0.1 2017-08-15 Fix-up release

- Fixed release date and documentation
Expand Down
2 changes: 2 additions & 0 deletions examples/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ Q=@
all: check

include ../src/cutest.mk
ifneq (${COVERAGE},0)
include ../src/coverage.mk
endif

clean::
$(Q)$(RM) -f *~
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ src:
@mkdir obj >/dev/null; make -s -C src

check:
@make -s -C test
@$(MAKE) -r --no-print-directory -C test

clean::
@rm -f *~ obj; make -s -C src clean; make -s -C test clean
@rm -f *~ obj; \
$(MAKE) -r --no-print-directory -C src clean; \
$(MAKE) -r --no-print-directory -C test clean
6 changes: 5 additions & 1 deletion src/cutest.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#define CUTEST_VERSION "1.0.1"
#define CUTEST_VERSION "1.0.2"

/*********************************************************************
*::
Expand Down Expand Up @@ -50,6 +50,10 @@
* Version history
* ---------------
*
* * v1.0.2 yyyy-mm-dd Release work flow enhancements
*
* - Fixed the documentation generator to be run before release
*
* * v1.0.1 2017-08-15 Fix-up release
*
* - Fixed release date and documentation
Expand Down

0 comments on commit ccfae0c

Please sign in to comment.