Makefile: Added optional CFGDIR parameter that allows user to specify where Cppcheck will look for cfg files.
This commit is contained in:
parent
367078e1bb
commit
d3a848f2e6
4
Makefile
4
Makefile
|
@ -57,6 +57,10 @@ ifndef CXXFLAGS
|
||||||
CXXFLAGS=-pedantic -Wall -Wextra -Wabi -Wcast-qual -Wconversion -Wfloat-equal -Winline -Wmissing-declarations -Wmissing-format-attribute -Wno-long-long -Woverloaded-virtual -Wpacked -Wredundant-decls -Wshadow -Wsign-promo $(CPPCHK_GLIBCXX_DEBUG) -g
|
CXXFLAGS=-pedantic -Wall -Wextra -Wabi -Wcast-qual -Wconversion -Wfloat-equal -Winline -Wmissing-declarations -Wmissing-format-attribute -Wno-long-long -Woverloaded-virtual -Wpacked -Wredundant-decls -Wshadow -Wsign-promo $(CPPCHK_GLIBCXX_DEBUG) -g
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifdef CFGDIR
|
||||||
|
CXXFLAGS += -DCFGDIR=\"$(CFGDIR)\"
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(HAVE_RULES),yes)
|
ifeq ($(HAVE_RULES),yes)
|
||||||
CXXFLAGS += -DHAVE_RULES -DTIXML_USE_STL $(shell pcre-config --cflags)
|
CXXFLAGS += -DHAVE_RULES -DTIXML_USE_STL $(shell pcre-config --cflags)
|
||||||
ifdef LIBS
|
ifdef LIBS
|
||||||
|
|
|
@ -58,8 +58,13 @@ bool Library::load(const char exename[], const char path[])
|
||||||
|
|
||||||
if (error == tinyxml2::XML_ERROR_FILE_NOT_FOUND) {
|
if (error == tinyxml2::XML_ERROR_FILE_NOT_FOUND) {
|
||||||
// Try to locate the library configuration in the installation folder..
|
// Try to locate the library configuration in the installation folder..
|
||||||
const std::string installfolder = Path::fromNativeSeparators(Path::getPathFromFilename(exename));
|
#ifdef CFGDIR
|
||||||
const std::string filename = installfolder + "cfg/" + fullfilename;
|
const std::string cfgfolder(CFGDIR);
|
||||||
|
#else
|
||||||
|
const std::string cfgfolder(Path::fromNativeSeparators(Path::getPathFromFilename(exename)) + "cfg");
|
||||||
|
#endif
|
||||||
|
const char *sep = (!cfgfolder.empty() && cfgfolder[cfgfolder.size()-1U]=='/' ? "" : "/");
|
||||||
|
const std::string filename(cfgfolder + sep + fullfilename);
|
||||||
error = doc.LoadFile(filename.c_str());
|
error = doc.LoadFile(filename.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
19
readme.md
19
readme.md
|
@ -60,18 +60,23 @@ http://software-download.name/pcre-library-windows/
|
||||||
|
|
||||||
### gnu make
|
### gnu make
|
||||||
|
|
||||||
To build Cppcheck with rules (PCRE dependency):
|
Simple build (no dependencies):
|
||||||
|
|
||||||
```shell
|
|
||||||
make HAVE_RULES=yes
|
|
||||||
```
|
|
||||||
|
|
||||||
To build Cppcheck without rules (no dependencies):
|
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
make
|
make
|
||||||
```
|
```
|
||||||
|
|
||||||
|
The recommended release build is:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
make SRCDIR=build CFGDIR=cfg HAVE_RULES=yes
|
||||||
|
```
|
||||||
|
|
||||||
|
Flags:
|
||||||
|
SRCDIR=build : Python is used to optimise cppcheck
|
||||||
|
CFGDIR=cfg : Specify folder where .cfg files are found
|
||||||
|
HAVE_RULES=yes : Enable rules (pcre is required if this is used)
|
||||||
|
|
||||||
### g++ (for experts)
|
### g++ (for experts)
|
||||||
|
|
||||||
If you just want to build Cppcheck without dependencies then you can use this command:
|
If you just want to build Cppcheck without dependencies then you can use this command:
|
||||||
|
|
15
readme.txt
15
readme.txt
|
@ -54,15 +54,16 @@ Compiling
|
||||||
|
|
||||||
gnu make
|
gnu make
|
||||||
========
|
========
|
||||||
To build Cppcheck with rules (pcre dependency):
|
Simple build (no dependencies):
|
||||||
make HAVE_RULES=yes
|
|
||||||
|
|
||||||
To build Cppcheck without rules (no dependencies):
|
|
||||||
make
|
make
|
||||||
|
|
||||||
If you have python it is recommended that you add "SRCDIR=build". When
|
The recommended release build is:
|
||||||
that is used, the Makefile uses python to compile Cppcheck (but python
|
make SRCDIR=build CFGDIR=cfg HAVE_RULES=yes
|
||||||
is not used at runtime). The advantage is that it makes Cppcheck faster.
|
|
||||||
|
Flags:
|
||||||
|
SRCDIR=build : Python is used to optimise cppcheck
|
||||||
|
CFGDIR=cfg : Specify folder where .cfg files are found
|
||||||
|
HAVE_RULES=yes : Enable rules (pcre is required if this is used)
|
||||||
|
|
||||||
g++ (for experts)
|
g++ (for experts)
|
||||||
=================
|
=================
|
||||||
|
|
|
@ -313,6 +313,11 @@ int main(int argc, char **argv)
|
||||||
"-g");
|
"-g");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// explicit cfg dir..
|
||||||
|
fout << "ifdef CFGDIR\n"
|
||||||
|
<< " CXXFLAGS += -DCFGDIR=\\\"$(CFGDIR)\\\"\n"
|
||||||
|
<< "endif\n\n";
|
||||||
|
|
||||||
fout << "ifeq ($(HAVE_RULES),yes)\n"
|
fout << "ifeq ($(HAVE_RULES),yes)\n"
|
||||||
<< " CXXFLAGS += -DHAVE_RULES -DTIXML_USE_STL $(shell pcre-config --cflags)\n"
|
<< " CXXFLAGS += -DHAVE_RULES -DTIXML_USE_STL $(shell pcre-config --cflags)\n"
|
||||||
<< " ifdef LIBS\n"
|
<< " ifdef LIBS\n"
|
||||||
|
|
Loading…
Reference in New Issue