Raw File
Makefile.in
#
# makefile for the Gauss package                             Mohamed Barakat
#                                                              Simon Görtzen
#                                                            Max Neunhoeffer
#
#  This file is free software, see license information at the end.
#

GAPPATH = @GAPPATH@

# read GAP's build settings
include $(GAPPATH)/sysinfo.gap

# the following settings are provided by sysinfo.gap in GAP >= 4.12;
# for compatibility with older GAP version (at least 4.9, 4.10, 4.11)
# we try to "guess" suitable values here
GAP ?= $(GAPPATH)/gap
GAC ?= $(GAPPATH)/gac

.PHONY: default static doc clean distclean docclean test

default: bin/$(GAParch)/gauss.so

bin/$(GAParch)/gauss.so: src/gauss.c
	mkdir -p bin/$(GAParch)
	$(GAC) -d -o bin/$(GAParch)/gauss.so src/gauss.c

doc: doc/manual.six

doc/manual.six:	makedoc.g \
		PackageInfo.g \
		gap/*.gd gap/*.gi
		gap makedoc.g

clean:
	rm -rf bin/$(GAParch) Makefile *~

distclean:
	rm -rf bin Makefile Makefile-*

docclean:
	(cd doc; ./clean)

## from PackageJanitor
test: doc
	gap tst/testall.g

test-basic-spacing:
	grep -RPl "\t" examples/ gap/ && echo "Tabs found" && exit 1 || exit 0
	grep -RPl "\r" gap/ && echo "Windows line-endings found" && exit 1 || exit 0
	# the second grep is a hack to fix the exit code with -L for grep <= 3.1
	grep -RPzL "\n\z" gap/ | grep "" && echo "File with no newline at end of file found" && exit 1 || exit 0

test-doc: doc
	cp -aT doc/ doc_tmp/
	cd doc_tmp && ./clean
	gap --quitonbreak makedoc_with_overfull_hbox_warnings.g | perl -pe 'END { exit $$status } $$status=1 if /#W/;'

test-with-coverage: doc
	gap --quitonbreak --cover stats tst/testall.g
	echo 'LoadPackage("profiling"); OutputJsonCoverage("stats", "coverage.json");' | gap --quitonbreak

test-spacing:
	grep -R "[^ [\"]  " gap/*.gi && echo "Duplicate spaces found" && exit 1 || exit 0
	grep -RE '[^ ] +$$' gap/* && echo "Trailing whitespace found" && exit 1 || exit 0
	for filename in gap/*; do \
		echo $$filename; \
		echo "LoadPackage(\"Gauss\"); SizeScreen([4096]); func := ReadAsFunction(\"$$filename\"); FileString(\"gap_spacing\", DisplayString(func));" | gap --quitonbreak --banner; \
		echo -e "\033[0m"; \
		# In a perfect world, the DisplayString of a function would exactly match our code. However, our line breaks and indentation might differ from the GAP ones, \
		# so we remove all indentation, line breaks, and empty lines, and afterwards insert line breaks at semicolons again for better readability. \
		cat "gap_spacing" | tail -n +2 | head -n -2 | sed 's/\[  \]/[ ]/g' | sed 's/(  )/( )/g' | sed 's/(  :/( :/g' | sed 's/ *$$//' | sed 's/^ *//' | grep -v "^$$" | tr "\n" " " | sed 's/;/;\n/g' > modified_gap_spacing; \
		cat "$$filename" | grep -v "^ *[#]" | sed 's/^ *//' | grep -v "^$$" | tr "\n" " " | sed "s/;/;\n/g" > modified_custom_spacing; \
		# Our code might still differ from the GAP code, for example because of additional brackets. \
		# Thus, we diff the code once as expected and once ignoring all space. Diffing the two diffs then shows lines which only differ by spacing. \
		diff modified_gap_spacing modified_custom_spacing > spacing_diff; \
		diff modified_gap_spacing modified_custom_spacing --ignore-all-space --ignore-space-change --ignore-trailing-space --ignore-blank-lines > spacing_diff_no_blanks; \
		diff spacing_diff_no_blanks spacing_diff || exit; \
	done
	rm gap_spacing
	rm modified_gap_spacing
	rm modified_custom_spacing
	rm spacing_diff
	rm spacing_diff_no_blanks

ci-test: test-basic-spacing test-with-coverage

##
##  This program is free software; you can redistribute it and/or modify
##  it under the terms of the GNU General Public License as published by
##  the Free Software Foundation; either version 2 of the License,
##  or (at your option) any later version.
##
##  This program is distributed in the hope that it will be useful,
##  but WITHOUT ANY WARRANTY; without even the implied warranty of
##  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
##  GNU General Public License for more details.
##
##  You should have received a copy of the GNU General Public License
##  along with this program; if not, write to the Free Software
##  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
##
back to top