From 1cf8c24537715c9e1f6ee684bb44470c74313b3f Mon Sep 17 00:00:00 2001 From: Michael Uleysky Date: Tue, 15 Sep 2015 15:38:55 +1000 Subject: [PATCH] Move includes in separate dir --- .gitignore | 7 +++++++ {src => include}/builtin.h | 0 {src => include}/common.h | 0 {src => include}/deptree.h | 0 {src => include}/globals.h | 0 {src => include}/init.h | 0 {src => include}/object.h | 0 {src/parser => include}/parser.h | 0 src/.gitignore | 6 ------ src/Makefile | 26 ++++++++++++++++---------- src/init.cpp | 6 +++--- src/parser/grammatical.y | 6 +++--- src/parser/lexical.l | 4 ++-- 13 files changed, 31 insertions(+), 24 deletions(-) create mode 100644 .gitignore rename {src => include}/builtin.h (100%) rename {src => include}/common.h (100%) rename {src => include}/deptree.h (100%) rename {src => include}/globals.h (100%) rename {src => include}/init.h (100%) rename {src => include}/object.h (100%) rename {src/parser => include}/parser.h (100%) delete mode 100644 src/.gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4c9fc34 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +*.[od] +*.so +include/grammatical.h +src/parser/grammatical.cpp +include/lexical.h +src/parser/lexical.cpp +src/makemap \ No newline at end of file diff --git a/src/builtin.h b/include/builtin.h similarity index 100% rename from src/builtin.h rename to include/builtin.h diff --git a/src/common.h b/include/common.h similarity index 100% rename from src/common.h rename to include/common.h diff --git a/src/deptree.h b/include/deptree.h similarity index 100% rename from src/deptree.h rename to include/deptree.h diff --git a/src/globals.h b/include/globals.h similarity index 100% rename from src/globals.h rename to include/globals.h diff --git a/src/init.h b/include/init.h similarity index 100% rename from src/init.h rename to include/init.h diff --git a/src/object.h b/include/object.h similarity index 100% rename from src/object.h rename to include/object.h diff --git a/src/parser/parser.h b/include/parser.h similarity index 100% rename from src/parser/parser.h rename to include/parser.h diff --git a/src/.gitignore b/src/.gitignore deleted file mode 100644 index 4dbf4ec..0000000 --- a/src/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -*.[od] -parser/grammatical.h -parser/grammatical.cpp -parser/lexical.h -parser/lexical.cpp -makemap \ No newline at end of file diff --git a/src/Makefile b/src/Makefile index c79be2b..7dc7589 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,5 +1,11 @@ -CFLAGS=-O2 -g -std=gnu++11 -fvisibility=hidden -fpic -flto -pthread -Wall -LDFLAGS=-O2 -fvisibility=hidden -Wl,--export-dynamic -fpic -flto -pthread -Wall +OPTFLAGS=-O2 -flto -g +EXPORTFLAGS=-fvisibility=hidden -fpic -Wl,--export-dynamic +CPPFLAGS=-std=gnu++11 -I../include +LIBSFLAGS=-lpthread +WARNFLAGS=-Wall + +CFLAGS=$(OPTFLAGS) $(EXPORTFLAGS) $(WARNFLAGS) $(CPPFLAGS) +LDFLAGS=$(OPTFLAGS) $(EXPORTFLAGS) $(WARNFLAGS) $(LIBSFLAGS) CC=g++ @@ -16,27 +22,27 @@ include $(DEPENDS) $(CC) -c $(CFLAGS) -o $@ $< %.d: %.cpp - $(CC) $(CFLAGS) -MM -MT $(subst .cpp,.o,$<) $< | sed 's%\(^.*\):%\1 $@ :%g' >$@ + $(CC) $(CPPFLAGS) -MM -MT $(subst .cpp,.o,$<) $< | sed 's%\(^.*\):%\1 $@ :%g' >$@ -$(DEPENDS): parser/grammatical.h parser/lexical.h +$(DEPENDS): ../include/grammatical.h ../include/lexical.h -parser/grammatical.d: parser/lexical.h +parser/grammatical.d: ../include/lexical.h parser/lexical.cpp: parser/lexical.l cd parser && flex lexical.l - [ -f parser/lexical.h ] && touch parser/lexical.h + [ -f ../include/lexical.h ] && touch ../include/lexical.h parser/grammatical.cpp: parser/grammatical.y cd parser && bison grammatical.y - [ -f parser/grammatical.h ] && touch parser/grammatical.h + [ -f ../include/grammatical.h ] && touch ../include/grammatical.h -parser/grammatical.h: parser/grammatical.y parser/grammatical.cpp -parser/lexical.h: parser/lexical.l parser/lexical.cpp +../include/grammatical.h: parser/grammatical.y parser/grammatical.cpp +../include/lexical.h: parser/lexical.l parser/lexical.cpp clean: - rm -f *.o *.d parser/*.{o,d} parser/{lexical,grammatical}.{cpp,h} + rm -f *.o *.d parser/*.{o,d} parser/{lexical,grammatical}.cpp ../include/{lexical,grammatical}.h distclean: clean rm -f makemap \ No newline at end of file diff --git a/src/init.cpp b/src/init.cpp index beebf6d..ce795b6 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -3,17 +3,17 @@ #include "object.h" #include "globals.h" #include "builtin.h" -#include "parser/parser.h" +#include "parser.h" // We can't include lexical.h before grammatical.h, because of strange errors, but grammatical.h only needs definition of yyscan_t #ifndef YY_TYPEDEF_YY_SCANNER_T #define YY_TYPEDEF_YY_SCANNER_T typedef void* yyscan_t; #endif -#include "parser/grammatical.h" +#include "grammatical.h" // definitions for bison-bridge #define YYSTYPE CONFSTYPE #define YYLTYPE CONFLTYPE -#include "parser/lexical.h" +#include "lexical.h" #undef YYSTYPE #undef YYLTYPE diff --git a/src/parser/grammatical.y b/src/parser/grammatical.y index 1bddc3d..266dc88 100644 --- a/src/parser/grammatical.y +++ b/src/parser/grammatical.y @@ -1,6 +1,6 @@ %language "c" %output "grammatical.cpp" -%defines "grammatical.h" +%defines "../../include/grammatical.h" %param {yyscan_t scanner} %define api.prefix {conf} %define api.pure full @@ -18,8 +18,8 @@ #include #include #include "parser.h" -#include "../object.h" -#include "../globals.h" +#include "object.h" +#include "globals.h" // We can't include lexical.h before grammatical.h, because of strange errors, but grammatical.h only needs definition of yyscan_t #ifndef YY_TYPEDEF_YY_SCANNER_T #define YY_TYPEDEF_YY_SCANNER_T diff --git a/src/parser/lexical.l b/src/parser/lexical.l index 95af407..a39b3ba 100644 --- a/src/parser/lexical.l +++ b/src/parser/lexical.l @@ -2,7 +2,7 @@ %option warn %option yylineno %option noyywrap -%option header-file="lexical.h" +%option header-file="../../include/lexical.h" %option outfile="lexical.cpp" %option prefix="conf" %option extra-type="struct lexical_extra*" @@ -15,7 +15,7 @@ %x INCLUDE %{ -#include "../common.h" +#include "common.h" #include "parser.h" // flex use register keyword, but it deprecated in C++11. #define register