|
| 1 | +# -*- makefile -*- |
| 2 | +# SPDX-License-Identifier: BSD-2-Clause |
| 3 | +# |
| 4 | +# Makefile wrapper to parallelize running travis |
| 5 | +# |
| 6 | +# Run from the main Makefile with "make travis" |
| 7 | +# This Makefile, unlike the main one, assumes GNU make or equivalent |
| 8 | +# |
| 9 | + |
| 10 | +srcdir = @srcdir@ |
| 11 | +objdir = @builddir@ |
| 12 | +VPATH = @srcdir@ |
| 13 | + |
| 14 | +PYTHON3 = @PYTHON3@ |
| 15 | +GREP = grep |
| 16 | + |
| 17 | +tools = $(srcdir)/tools |
| 18 | + |
| 19 | +PERL = perl |
| 20 | +PERLFLAGS = -I$(srcdir)/perllib |
| 21 | +RUNPERL = $(PERL) $(PERLFLAGS) |
| 22 | + |
| 23 | +NASM = $(objdir)/nasm$(X) |
| 24 | + |
| 25 | +PERL = perl |
| 26 | +RUNPERL = $(PERL) |
| 27 | + |
| 28 | +PYTHON3 = @PYTHON3@ |
| 29 | +GREP = grep |
| 30 | + |
| 31 | +travistools = $(tools)/travis |
| 32 | +TRAVIS = $(travistools)/nasm-t.py |
| 33 | +testdir = travis |
| 34 | + |
| 35 | +tests := $(shell $(RUNPERL) $(travistools)/findtests.pl $(srcdir) $(objdir) $(testdir)) |
| 36 | +logs = $(tests:.json=.log) |
| 37 | + |
| 38 | +all: travis.log |
| 39 | + @ ! $(GREP) FAIL travis.log && echo '=== All tests PASS ===' |
| 40 | + |
| 41 | +.PRECIOUS: travis.log |
| 42 | +travis.log: $(logs) |
| 43 | + @cat $(logs) > travis.log |
| 44 | + |
| 45 | +.PRECIOUS: %.log |
| 46 | +%.log: $(NASM) %.json |
| 47 | + @echo 'Running: $(@D)' |
| 48 | + @$(PYTHON3) $(TRAVIS) -d $(srcdir)/$(@D) \ |
| 49 | + --nasm $(NASM) run --stop=n > $@ |
| 50 | + |
| 51 | +.PHONY: update |
| 52 | +update: $(tests:.json=.update) |
| 53 | + |
| 54 | +.PHONY: %.update |
| 55 | +%.update: |
| 56 | + @echo 'Updating: $(@D)' |
| 57 | + @$(PYTHON3) $(TRAVIS) -d $(srcdir)/$(@D) --nasm $(NASM) update |
| 58 | + |
| 59 | +# |
| 60 | +# Generated files needed for some specific tests |
| 61 | +# (If this ends up being a longer list, consider making subdirectory- |
| 62 | +# specific Makefiles). |
| 63 | +# |
| 64 | +GENFILES = $(testdir)/_version/_version.stdout |
| 65 | + |
| 66 | +$(testdir)/_version/_version.stdout: version |
| 67 | + printf 'NASM version %s compiled on ?\n' `cat version` > $@ |
| 68 | + |
| 69 | +$(testdir)/_version/_version.log: $(testdir)/_version/_version.stdout |
| 70 | + |
| 71 | +# XXX: need to clean up build artifacts, too |
| 72 | +clean: |
| 73 | + rm -f travis.log $(logs) |
0 commit comments