Browse Source

Move includes in separate dir

test
Michael Uleysky 9 years ago
parent
commit
1cf8c24537
  1. 7
      .gitignore
  2. 0
      include/builtin.h
  3. 0
      include/common.h
  4. 0
      include/deptree.h
  5. 0
      include/globals.h
  6. 0
      include/init.h
  7. 0
      include/object.h
  8. 0
      include/parser.h
  9. 6
      src/.gitignore
  10. 26
      src/Makefile
  11. 6
      src/init.cpp
  12. 6
      src/parser/grammatical.y
  13. 4
      src/parser/lexical.l

7
.gitignore vendored

@ -0,0 +1,7 @@
*.[od]
*.so
include/grammatical.h
src/parser/grammatical.cpp
include/lexical.h
src/parser/lexical.cpp
src/makemap

0
src/builtin.h → include/builtin.h

0
src/common.h → include/common.h

0
src/deptree.h → include/deptree.h

0
src/globals.h → include/globals.h

0
src/init.h → include/init.h

0
src/object.h → include/object.h

0
src/parser/parser.h → include/parser.h

6
src/.gitignore vendored

@ -1,6 +0,0 @@
*.[od]
parser/grammatical.h
parser/grammatical.cpp
parser/lexical.h
parser/lexical.cpp
makemap

26
src/Makefile

@ -1,5 +1,11 @@
CFLAGS=-O2 -g -std=gnu++11 -fvisibility=hidden -fpic -flto -pthread -Wall OPTFLAGS=-O2 -flto -g
LDFLAGS=-O2 -fvisibility=hidden -Wl,--export-dynamic -fpic -flto -pthread -Wall 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++ CC=g++
@ -16,27 +22,27 @@ include $(DEPENDS)
$(CC) -c $(CFLAGS) -o $@ $< $(CC) -c $(CFLAGS) -o $@ $<
%.d: %.cpp %.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 parser/lexical.cpp: parser/lexical.l
cd parser && flex 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 parser/grammatical.cpp: parser/grammatical.y
cd parser && bison 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 ../include/grammatical.h: parser/grammatical.y parser/grammatical.cpp
parser/lexical.h: parser/lexical.l parser/lexical.cpp ../include/lexical.h: parser/lexical.l parser/lexical.cpp
clean: 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 distclean: clean
rm -f makemap rm -f makemap

6
src/init.cpp

@ -3,17 +3,17 @@
#include "object.h" #include "object.h"
#include "globals.h" #include "globals.h"
#include "builtin.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 // 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 #ifndef YY_TYPEDEF_YY_SCANNER_T
#define YY_TYPEDEF_YY_SCANNER_T #define YY_TYPEDEF_YY_SCANNER_T
typedef void* yyscan_t; typedef void* yyscan_t;
#endif #endif
#include "parser/grammatical.h" #include "grammatical.h"
// definitions for bison-bridge // definitions for bison-bridge
#define YYSTYPE CONFSTYPE #define YYSTYPE CONFSTYPE
#define YYLTYPE CONFLTYPE #define YYLTYPE CONFLTYPE
#include "parser/lexical.h" #include "lexical.h"
#undef YYSTYPE #undef YYSTYPE
#undef YYLTYPE #undef YYLTYPE

6
src/parser/grammatical.y

@ -1,6 +1,6 @@
%language "c" %language "c"
%output "grammatical.cpp" %output "grammatical.cpp"
%defines "grammatical.h" %defines "../../include/grammatical.h"
%param {yyscan_t scanner} %param {yyscan_t scanner}
%define api.prefix {conf} %define api.prefix {conf}
%define api.pure full %define api.pure full
@ -18,8 +18,8 @@
#include <inttypes.h> #include <inttypes.h>
#include <algorithm> #include <algorithm>
#include "parser.h" #include "parser.h"
#include "../object.h" #include "object.h"
#include "../globals.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 // 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 #ifndef YY_TYPEDEF_YY_SCANNER_T
#define YY_TYPEDEF_YY_SCANNER_T #define YY_TYPEDEF_YY_SCANNER_T

4
src/parser/lexical.l

@ -2,7 +2,7 @@
%option warn %option warn
%option yylineno %option yylineno
%option noyywrap %option noyywrap
%option header-file="lexical.h" %option header-file="../../include/lexical.h"
%option outfile="lexical.cpp" %option outfile="lexical.cpp"
%option prefix="conf" %option prefix="conf"
%option extra-type="struct lexical_extra*" %option extra-type="struct lexical_extra*"
@ -15,7 +15,7 @@
%x INCLUDE %x INCLUDE
%{ %{
#include "../common.h" #include "common.h"
#include "parser.h" #include "parser.h"
// flex use register keyword, but it deprecated in C++11. // flex use register keyword, but it deprecated in C++11.
#define register #define register

Loading…
Cancel
Save