Skip to content

Commit

Permalink
Add config.h with DATADIR define
Browse files Browse the repository at this point in the history
The define isn't used yet, but will be in the following commits.
  • Loading branch information
xaizek committed Feb 6, 2017
1 parent 017f9c1 commit ddca8c2
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
*.o
/uncov
/tests/tests
/config.h
9 changes: 8 additions & 1 deletion INSTALL.md
Original file line number Diff line number Diff line change
@@ -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 ####

Expand Down
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 2 additions & 0 deletions config.h.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Path to data (should take DESTDIR into account).
#define DATADIR "/usr/share/uncov"

0 comments on commit ddca8c2

Please sign in to comment.