Tue, 23 Aug 2016 12:05:41 +0200
adds version number and changes build system
Makefile | file | annotate | diff | comparison | revisions | |
clang.mk | file | annotate | diff | comparison | revisions | |
conf.mk | file | annotate | diff | comparison | revisions | |
gcc.mk | file | annotate | diff | comparison | revisions | |
src/Makefile | file | annotate | diff | comparison | revisions | |
src/c2html.c | file | annotate | diff | comparison | revisions | |
src/c2html.h | file | annotate | diff | comparison | revisions |
1.1 --- a/Makefile Fri Mar 04 15:02:22 2016 +0100 1.2 +++ b/Makefile Tue Aug 23 12:05:41 2016 +0200 1.3 @@ -26,17 +26,31 @@ 1.4 # POSSIBILITY OF SUCH DAMAGE. 1.5 # 1.6 1.7 -include conf.mk 1.8 +# available configs: gcc, clang 1.9 +CONF=gcc 1.10 1.11 -all: clean compile 1.12 +include $(CONF).mk 1.13 + 1.14 + 1.15 +SRC = c2html.c 1.16 +SRC += codegens.c 1.17 +SRC += ccodegen.c 1.18 +SRC += javacodegen.c 1.19 + 1.20 +OBJ = $(SRC:%.c=build/%$(OBJ_EXT)) 1.21 + 1.22 +all: build build/$(BIN) 1.23 1.24 -compile: build 1.25 - cd src; $(MAKE) 1.26 - 1.27 +build/$(BIN): $(OBJ) 1.28 + $(LD) -o $@ $^ $(LDFLAGS) 1.29 + 1.30 +build/%$(OBJ_EXT): src/%.c 1.31 + $(CC) -o $@ $(CFLAGS) -c $< 1.32 + 1.33 build: 1.34 $(MKDIR) build 1.35 1.36 -test: compile 1.37 +test: build/$(BIN) 1.38 ./build/$(BIN) test/ctestfile.c -o build/ctest.html \ 1.39 -H test/header.html -F test/footer.html 1.40 ./build/$(BIN) -j test/javatestfile.java -o build/javatest.html \ 1.41 @@ -46,4 +60,4 @@ 1.42 ./build/$(BIN) -p test/plain.csp -o build/plain.html \ 1.43 -H test/header.html -F test/footer.html 1.44 clean: 1.45 - $(RM) -f -R build 1.46 + $(RM) $(RMFLAGS) build
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/clang.mk Tue Aug 23 12:05:41 2016 +0200 2.3 @@ -0,0 +1,40 @@ 2.4 +# 2.5 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 2.6 +# 2.7 +# Copyright 2016 Mike Becker. All rights reserved. 2.8 +# 2.9 +# Redistribution and use in source and binary forms, with or without 2.10 +# modification, are permitted provided that the following conditions are met: 2.11 +# 2.12 +# 1. Redistributions of source code must retain the above copyright 2.13 +# notice, this list of conditions and the following disclaimer. 2.14 +# 2.15 +# 2. Redistributions in binary form must reproduce the above copyright 2.16 +# notice, this list of conditions and the following disclaimer in the 2.17 +# documentation and/or other materials provided with the distribution. 2.18 +# 2.19 +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 2.20 +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2.21 +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2.22 +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 2.23 +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 2.24 +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 2.25 +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 2.26 +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 2.27 +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 2.28 +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 2.29 +# POSSIBILITY OF SUCH DAMAGE. 2.30 +# 2.31 + 2.32 +# system related 2.33 +MKDIR = mkdir 2.34 +RM = rm 2.35 +RMFLAGS = -fR 2.36 + 2.37 +# build related 2.38 +BIN = c2html 2.39 +CC = clang 2.40 +CFLAGS = -O2 2.41 +LD = clang 2.42 +LDFLAGS = 2.43 +OBJ_EXT = .o
3.1 --- a/conf.mk Fri Mar 04 15:02:22 2016 +0100 3.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 3.3 @@ -1,39 +0,0 @@ 3.4 -# 3.5 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3.6 -# 3.7 -# Copyright 2016 Mike Becker. All rights reserved. 3.8 -# 3.9 -# Redistribution and use in source and binary forms, with or without 3.10 -# modification, are permitted provided that the following conditions are met: 3.11 -# 3.12 -# 1. Redistributions of source code must retain the above copyright 3.13 -# notice, this list of conditions and the following disclaimer. 3.14 -# 3.15 -# 2. Redistributions in binary form must reproduce the above copyright 3.16 -# notice, this list of conditions and the following disclaimer in the 3.17 -# documentation and/or other materials provided with the distribution. 3.18 -# 3.19 -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 3.20 -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 3.21 -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 3.22 -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 3.23 -# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 3.24 -# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 3.25 -# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 3.26 -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 3.27 -# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 3.28 -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 3.29 -# POSSIBILITY OF SUCH DAMAGE. 3.30 -# 3.31 - 3.32 -# system related 3.33 -MKDIR = mkdir 3.34 -RM = rm 3.35 - 3.36 -# build related 3.37 -BIN = c2html 3.38 -CC = gcc 3.39 -CFLAGS = -O2 -std=gnu99 3.40 -LD = gcc 3.41 -LDFLAGS = 3.42 -OBJ_EXT = .o
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 4.2 +++ b/gcc.mk Tue Aug 23 12:05:41 2016 +0200 4.3 @@ -0,0 +1,40 @@ 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 +# system related 4.33 +MKDIR = mkdir 4.34 +RM = rm 4.35 +RMFLAGS = -fR 4.36 + 4.37 +# build related 4.38 +BIN = c2html 4.39 +CC = gcc 4.40 +CFLAGS = -O2 -std=gnu99 4.41 +LD = gcc 4.42 +LDFLAGS = 4.43 +OBJ_EXT = .o
5.1 --- a/src/Makefile Fri Mar 04 15:02:22 2016 +0100 5.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 5.3 @@ -1,44 +0,0 @@ 5.4 -# 5.5 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 5.6 -# 5.7 -# Copyright 2016 Mike Becker. All rights reserved. 5.8 -# 5.9 -# Redistribution and use in source and binary forms, with or without 5.10 -# modification, are permitted provided that the following conditions are met: 5.11 -# 5.12 -# 1. Redistributions of source code must retain the above copyright 5.13 -# notice, this list of conditions and the following disclaimer. 5.14 -# 5.15 -# 2. Redistributions in binary form must reproduce the above copyright 5.16 -# notice, this list of conditions and the following disclaimer in the 5.17 -# documentation and/or other materials provided with the distribution. 5.18 -# 5.19 -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 5.20 -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 5.21 -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 5.22 -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 5.23 -# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 5.24 -# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 5.25 -# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 5.26 -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 5.27 -# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 5.28 -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 5.29 -# POSSIBILITY OF SUCH DAMAGE. 5.30 -# 5.31 - 5.32 -include ../conf.mk 5.33 - 5.34 -SRC = c2html.c 5.35 -SRC += codegens.c 5.36 -SRC += ccodegen.c 5.37 -SRC += javacodegen.c 5.38 - 5.39 -OBJ = $(SRC:%.c=../build/%$(OBJ_EXT)) 5.40 - 5.41 -all: $(OBJ) 5.42 - $(LD) -o ../build/$(BIN) $^ $(LDFLAGS) 5.43 - 5.44 - 5.45 -../build/%$(OBJ_EXT): %.c 5.46 - $(CC) -o $@ $(CFLAGS) -c $< 5.47 -
6.1 --- a/src/c2html.c Fri Mar 04 15:02:22 2016 +0100 6.2 +++ b/src/c2html.c Tue Aug 23 12:05:41 2016 +0200 6.3 @@ -111,9 +111,8 @@ 6.4 " -F <footer> Append footer file\n" 6.5 " -p Disable highlighting (plain text)\n" 6.6 " -l Disable line numbers\n" 6.7 + " -V, -v Prints version and exits\n" 6.8 "\n"); 6.9 - 6.10 - 6.11 } 6.12 6.13 int lnint(size_t lnc) { 6.14 @@ -221,7 +220,7 @@ 6.15 int lang = C2HTML_C; 6.16 6.17 char optc; 6.18 - while ((optc = getopt(argc, argv, "hljo:pH:F:")) != -1) { 6.19 + while ((optc = getopt(argc, argv, "hljo:pH:F:vV")) != -1) { 6.20 switch (optc) { 6.21 case 'o': 6.22 if (!(optarg[0] == '-' && optarg[1] == 0)) { 6.23 @@ -246,6 +245,14 @@ 6.24 case 'h': 6.25 printhelp(); 6.26 return 0; 6.27 + case 'v': 6.28 + case 'V': 6.29 +#ifdef VERSION_DEVELOP 6.30 + printf("%d.%d (unstable)\n", VERSION_MAJOR, VERSION_MINOR); 6.31 +#else 6.32 + printf("%d.%d\n", VERSION_MAJOR, VERSION_MINOR); 6.33 +#endif 6.34 + return 0; 6.35 default: 6.36 return 1; 6.37 }
7.1 --- a/src/c2html.h Fri Mar 04 15:02:22 2016 +0100 7.2 +++ b/src/c2html.h Tue Aug 23 12:05:41 2016 +0200 7.3 @@ -43,6 +43,10 @@ 7.4 #ifdef __cplusplus 7.5 extern "C" { 7.6 #endif 7.7 + 7.8 +#define VERSION_MAJOR 2 7.9 +#define VERSION_MINOR 0 7.10 +#define VERSION_DEVELOP 1 // set this to zero for release version 7.11 7.12 7.13 #define INPUTBUF_SIZE 2048