blob: 8242edf5d9aee553d2010c3e5feda27a6981fb34 [file] [log] [blame] [edit]
Notes on Makefile
------------------
March 12, 2014
To avoid issues with Visual Studio the generated lexer and parser code are
checked into revision control.
This allows a straight forward conventional build process with Visual Studio
on Windows, but means on linux-like systems the Makefile behaviour is somewhat
non-standard.
1) Calling 'make' will compile and generate the static library and test
executable, but will NOT re-generate the lexer and parser.
$ make
Compiling Source src/sdc_common.c...
Compiling Source src/sdc.c...
Compiling Lexer src/sdc_parse.lex.c...
Compiling Parser src/sdc_parse.tab.c...
Linking static library: libsdc_parse.a
Compiling Source src/main.c...
Linking executable: sdc_parse_test
2) Calling 'make clean' will remove all generted files EXCEPT the lexer and parser
$ make clean
rm -f obj/main.o obj/sdc_common.o obj/sdc.o obj/sdc_parse.lex.o obj/sdc_parse.tab.o
rm -f obj/main.d obj/sdc_common.d obj/sdc.d obj/sdc_parse.lex.d obj/sdc_parse.tab.d
rm -rf obj
rm -f sdc_parse_test
rm -f libsdc_parse.a
3) To force regeneration of the lexer and parser from the source .l and .y files
do the following (with flex and bison installed and on the path):
$ make grammar
Re-generating parser and lexer. Clean with 'make clean_grammar'.
Generating Parser src/sdc_parse.y...
Generating Lexer src/sdc_parse.l...
3) To force cleaning of the generated lexer and parser files do:
$ make clean_grammar
Removing generated parser and lexer. Regenerate with 'make grammar'.
rm -f src/sdc_parse.lex.c
rm -f src/sdc_parse.tab.c
MAKING CHANGES
------------------
It is recomended that you make any changes to the lexer and parser on a
linux-like platform, so you can use the Makefile as described above.
If you are making changes to the lexer or parser source files (sdc_parse.l and
sdc_parse.y), you must call 'make grammar' explicitly to re-generate the lexer
and parser, and then 'make' to compile the changes. You must commit the
re-generated lexer and parser files (sdc_parser.lex.c, sdc_parse.tab.c,
and sdc_parse.tab.h) allong with the lexer and parser sources if they have
changed. Do not let these files get out of sync.
MOTIVATION
------------------
In order to have a simple build process with Visual Studio on Windows, we have
checked-in the lexer and parser code generated by flex and bison. This means
that Windows users DO NOT need to install flex or bison and configure Visual
Studio to use them (which is a pain) if they just want to compile and use VPR.
Since we don't expect the supported grammar to change very often this seems a
reasonable trade-off.
The result is that by default the lexer and parser code are not re-generated
each compile. If you want to make modifications to the SDC lexer/parser, do
so on a linux-like platform with flex and bison on the command-line path with
the commands described above.