From ddca8c20935d514dd23a274f5de9422a9436b824 Mon Sep 17 00:00:00 2001 From: xaizek Date: Mon, 6 Feb 2017 22:14:30 +0200 Subject: [PATCH] Add config.h with DATADIR define The define isn't used yet, but will be in the following commits. --- .gitignore | 1 + INSTALL.md | 9 ++++++++- Makefile | 7 +++++-- config.h.in | 2 ++ 4 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 config.h.in diff --git a/.gitignore b/.gitignore index ba32f96..f6659c6 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ *.o /uncov /tests/tests +/config.h diff --git a/INSTALL.md b/INSTALL.md index a696f1f..9f85f65 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -1,4 +1,11 @@ -### Building ### +### Configuring ### + +`config.h.in` in the root is used to produce `config.h` by default, but one can +write custom `config.h` to change something. There is only `DATADIR` define +which specifies location of data after installation, make sure it accounts for +custom `DESTDIR` when it's used. + +### Build ### #### Defaults #### diff --git a/Makefile b/Makefile index 59a322e..4ae0925 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ CXXFLAGS += -std=c++11 -Wall -Wextra -Werror -MMD -I$(abspath src) -CXXFLAGS += -Wno-non-template-friend +CXXFLAGS += -Wno-non-template-friend -include config.h LDFLAGS += -g -lsqlite3 -lgit2 -lsource-highlight -lz LDFLAGS += -lboost_filesystem -lboost_iostreams -lboost_program_options LDFLAGS += -lboost_system @@ -150,7 +150,10 @@ $(out_dir)/tests/tests: EXTRA_CXXFLAGS += -Wno-error=parentheses -Itests/ $(out_dir)/tests/tests: $(tests_objects) tests/. | $(out_dirs) $(CXX) -o $@ $(tests_objects) $(LDFLAGS) $(EXTRA_LDFLAGS) -$(out_dir)/%.o: %.cpp | $(out_dirs) +config.h: | config.h.in + cp config.h.in $@ + +$(out_dir)/%.o: %.cpp config.h | $(out_dirs) $(CXX) -o $@ -c $(CXXFLAGS) $(EXTRA_CXXFLAGS) $< $(out_dirs) $(out_dir)/docs: diff --git a/config.h.in b/config.h.in new file mode 100644 index 0000000..fa9af4d --- /dev/null +++ b/config.h.in @@ -0,0 +1,2 @@ +// Path to data (should take DESTDIR into account). +#define DATADIR "/usr/share/uncov"