add separate Makefile for test

Sun, 11 Jun 2023 14:05:28 +0200

author
Mike Becker <universe@uap-core.de>
date
Sun, 11 Jun 2023 14:05:28 +0200
changeset 69
ff56b28e2cdd
parent 68
4d1ce98e09cc
child 70
60cecca5e484

add separate Makefile for test

Makefile file | annotate | diff | comparison | revisions
clang.mk file | annotate | diff | comparison | revisions
gcc.mk file | annotate | diff | comparison | revisions
test/Makefile file | annotate | diff | comparison | revisions
     1.1 --- a/Makefile	Mon Apr 24 21:02:00 2023 +0200
     1.2 +++ b/Makefile	Sun Jun 11 14:05:28 2023 +0200
     1.3 @@ -37,9 +37,9 @@
     1.4  
     1.5  OBJ = $(SRC:%.c=build/%$(OBJ_EXT))
     1.6  
     1.7 -all: build build/$(BIN)
     1.8 +all: build build/c2html
     1.9  	
    1.10 -build/$(BIN): $(OBJ)
    1.11 +build/c2html: $(OBJ)
    1.12  	$(LD) -o $@ $^ $(LDFLAGS)
    1.13  	
    1.14  build/%$(OBJ_EXT): src/%.c
    1.15 @@ -49,19 +49,7 @@
    1.16  	$(MKDIR) $@
    1.17  	
    1.18  test: all
    1.19 -	./build/$(BIN) test/ctest.c -o build/ctest.html \
    1.20 -	-H test/header.html -F test/footer.html
    1.21 -	./build/$(BIN) -j test/javatest.java -o build/javatest.html \
    1.22 -	-H test/jheader.html -F test/footer.html
    1.23 -	./build/$(BIN) test/bigtest.c -o build/bigtest.html \
    1.24 -	-H test/header.html -F test/footer.html
    1.25 -	./build/$(BIN) -p test/plain.txt -o build/plain.html \
    1.26 -	-H test/header.html -F test/footer.html
    1.27 -	diff build/ctest.html test/gs/ctest.html && \
    1.28 -	diff build/javatest.html test/gs/javatest.html && \
    1.29 -	diff build/bigtest.html test/gs/bigtest.html && \
    1.30 -	diff build/plain.html test/gs/plain.html
    1.31 -	@echo "Tests successful."
    1.32 +	cd test && $(MAKE)
    1.33  	
    1.34  clean:
    1.35  	$(RM) $(RMFLAGS) build
     2.1 --- a/clang.mk	Mon Apr 24 21:02:00 2023 +0200
     2.2 +++ b/clang.mk	Sun Jun 11 14:05:28 2023 +0200
     2.3 @@ -32,7 +32,6 @@
     2.4  RMFLAGS = -fR
     2.5  
     2.6  # build related
     2.7 -BIN     = c2html
     2.8  CC      = clang
     2.9  CFLAGS  = -O2
    2.10  LD      = clang
     3.1 --- a/gcc.mk	Mon Apr 24 21:02:00 2023 +0200
     3.2 +++ b/gcc.mk	Sun Jun 11 14:05:28 2023 +0200
     3.3 @@ -32,7 +32,6 @@
     3.4  RMFLAGS = -fR
     3.5  
     3.6  # build related
     3.7 -BIN     = c2html
     3.8  CC      = gcc
     3.9  CFLAGS  = -O2 -std=gnu99
    3.10  LD      = gcc
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/test/Makefile	Sun Jun 11 14:05:28 2023 +0200
     4.3 @@ -0,0 +1,44 @@
     4.4 +#
     4.5 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
     4.6 +#
     4.7 +# Copyright 2016 Mike Becker. All rights reserved.
     4.8 +#
     4.9 +# Redistribution and use in source and binary forms, with or without
    4.10 +# modification, are permitted provided that the following conditions are met:
    4.11 +#
    4.12 +#   1. Redistributions of source code must retain the above copyright
    4.13 +#      notice, this list of conditions and the following disclaimer.
    4.14 +#
    4.15 +#   2. Redistributions in binary form must reproduce the above copyright
    4.16 +#      notice, this list of conditions and the following disclaimer in the
    4.17 +#      documentation and/or other materials provided with the distribution.
    4.18 +#
    4.19 +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
    4.20 +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    4.21 +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    4.22 +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
    4.23 +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
    4.24 +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
    4.25 +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
    4.26 +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
    4.27 +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    4.28 +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    4.29 +# POSSIBILITY OF SUCH DAMAGE.
    4.30 +#
    4.31 +
    4.32 +BUILDDIR=../build
    4.33 +
    4.34 +all:
    4.35 +	$(BUILDDIR)/c2html ctest.c -o $(BUILDDIR)/ctest.html \
    4.36 +	-H header.html -F footer.html
    4.37 +	$(BUILDDIR)/c2html -j javatest.java -o $(BUILDDIR)/javatest.html \
    4.38 +	-H jheader.html -F footer.html
    4.39 +	$(BUILDDIR)/c2html bigtest.c -o $(BUILDDIR)/bigtest.html \
    4.40 +	-H header.html -F footer.html
    4.41 +	$(BUILDDIR)/c2html -p plain.txt -o $(BUILDDIR)/plain.html \
    4.42 +	-H header.html -F footer.html
    4.43 +	diff $(BUILDDIR)/ctest.html gs/ctest.html && \
    4.44 +	diff $(BUILDDIR)/javatest.html gs/javatest.html && \
    4.45 +	diff $(BUILDDIR)/bigtest.html gs/bigtest.html && \
    4.46 +	diff $(BUILDDIR)/plain.html gs/plain.html
    4.47 +	@echo "Tests successful."
    4.48 \ No newline at end of file

mercurial