Skip to content

Commit 48f8f82

Browse files
authored
tools: moved dmake to its own folder (danmar#5873)
This is the first step in trying to unclutter the `tools` folder a bit which has been the dumping group for all kinds of unrelated things over the years.
1 parent d5a054c commit 48f8f82

File tree

8 files changed

+43
-43
lines changed

8 files changed

+43
-43
lines changed

Diff for: .gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ tags
1313
/testrunner
1414
/testrunner.exe
1515
tools/daca2*.html
16-
tools/dmake
1716
tools/errmsg
1817
tools/extracttests
1918

Diff for: Makefile

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This file is generated by tools/dmake, do not edit.
1+
# This file is generated by dmake, do not edit.
22

33
ifndef VERBOSE
44
VERBOSE=
@@ -361,7 +361,7 @@ check: all
361361
checkcfg: cppcheck validateCFG
362362
./test/cfg/runtests.sh
363363

364-
dmake: tools/dmake.o cli/filelister.o $(libcppdir)/pathmatch.o $(libcppdir)/path.o $(libcppdir)/utils.o externals/simplecpp/simplecpp.o
364+
dmake: tools/dmake/dmake.o cli/filelister.o $(libcppdir)/pathmatch.o $(libcppdir)/path.o $(libcppdir)/utils.o externals/simplecpp/simplecpp.o
365365
$(CXX) $(CXXFLAGS) -o $@ $^ $(LDFLAGS)
366366

367367
run-dmake: dmake
@@ -896,6 +896,6 @@ externals/simplecpp/simplecpp.o: externals/simplecpp/simplecpp.cpp externals/sim
896896
externals/tinyxml2/tinyxml2.o: externals/tinyxml2/tinyxml2.cpp externals/tinyxml2/tinyxml2.h
897897
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -w -c -o $@ externals/tinyxml2/tinyxml2.cpp
898898

899-
tools/dmake.o: tools/dmake.cpp cli/filelister.h lib/config.h lib/pathmatch.h lib/utils.h
900-
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ tools/dmake.cpp
899+
tools/dmake/dmake.o: tools/dmake/dmake.cpp cli/filelister.h lib/config.h lib/pathmatch.h lib/utils.h
900+
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ tools/dmake/dmake.cpp
901901

Diff for: cppcheck.sln

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testrunner", "test\testrunn
1515
EndProject
1616
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cppcheck", "lib\cppcheck.vcxproj", "{C183DB5B-AD6C-423D-80CA-1F9549555A1A}"
1717
EndProject
18-
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dmake", "tools\dmake.vcxproj", "{19EC86CD-0004-4917-B852-E6BD110B6E6F}"
18+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dmake", "tools\dmake\dmake.vcxproj", "{19EC86CD-0004-4917-B852-E6BD110B6E6F}"
1919
EndProject
2020
Global
2121
GlobalSection(SolutionConfigurationPlatforms) = preSolution

Diff for: tools/CMakeLists.txt

+1-32
Original file line numberDiff line numberDiff line change
@@ -1,32 +1 @@
1-
# TODO: when using ccache and matchcompiler this will accessed before the file was generated and thus the build fails
2-
set(srcs_lib pathmatch.cpp path.cpp)
3-
foreach(file ${srcs_lib})
4-
if (NOT USE_MATCHCOMPILER_OPT STREQUAL "Off")
5-
set(src "${CMAKE_BINARY_DIR}/lib/build/mc_${file}")
6-
set_source_files_properties(${src} PROPERTIES GENERATED TRUE)
7-
else()
8-
set(src "${CMAKE_SOURCE_DIR}/lib/${file}")
9-
endif()
10-
set(srcs_tools ${srcs_tools} ${src})
11-
endforeach()
12-
13-
add_executable(dmake EXCLUDE_FROM_ALL
14-
dmake.cpp
15-
${CMAKE_SOURCE_DIR}/cli/filelister.cpp
16-
${srcs_tools}
17-
${CMAKE_SOURCE_DIR}/lib/utils.cpp
18-
$<TARGET_OBJECTS:simplecpp_objs>
19-
)
20-
target_include_directories(dmake PRIVATE ${CMAKE_SOURCE_DIR}/cli ${CMAKE_SOURCE_DIR}/lib)
21-
target_externals_include_directories(dmake PRIVATE ${CMAKE_SOURCE_DIR}/externals/simplecpp)
22-
if (WIN32 AND NOT BORLAND)
23-
if(NOT MINGW)
24-
target_link_libraries(dmake Shlwapi.lib)
25-
else()
26-
target_link_libraries(dmake shlwapi)
27-
endif()
28-
endif()
29-
30-
add_custom_target(run-dmake $<TARGET_FILE:dmake>
31-
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
32-
DEPENDS dmake)
1+
add_subdirectory(dmake)

Diff for: tools/dmake/CMakeLists.txt

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# TODO: when using ccache and matchcompiler this will accessed before the file was generated and thus the build fails
2+
set(srcs_lib pathmatch.cpp path.cpp)
3+
foreach(file ${srcs_lib})
4+
if (NOT USE_MATCHCOMPILER_OPT STREQUAL "Off")
5+
set(src "${CMAKE_BINARY_DIR}/lib/build/mc_${file}")
6+
set_source_files_properties(${src} PROPERTIES GENERATED TRUE)
7+
else()
8+
set(src "${CMAKE_SOURCE_DIR}/lib/${file}")
9+
endif()
10+
set(srcs_tools ${srcs_tools} ${src})
11+
endforeach()
12+
13+
add_executable(dmake EXCLUDE_FROM_ALL
14+
dmake.cpp
15+
${CMAKE_SOURCE_DIR}/cli/filelister.cpp
16+
${srcs_tools}
17+
${CMAKE_SOURCE_DIR}/lib/utils.cpp
18+
$<TARGET_OBJECTS:simplecpp_objs>
19+
)
20+
target_include_directories(dmake PRIVATE ${CMAKE_SOURCE_DIR}/cli ${CMAKE_SOURCE_DIR}/lib)
21+
target_externals_include_directories(dmake PRIVATE ${CMAKE_SOURCE_DIR}/externals/simplecpp)
22+
if (WIN32 AND NOT BORLAND)
23+
if(NOT MINGW)
24+
target_link_libraries(dmake Shlwapi.lib)
25+
else()
26+
target_link_libraries(dmake shlwapi)
27+
endif()
28+
endif()
29+
30+
add_custom_target(run-dmake $<TARGET_FILE:dmake>
31+
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
32+
DEPENDS dmake)

Diff for: tools/dmake.cpp renamed to tools/dmake/dmake.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ static void getDeps(const std::string &filename, std::vector<std::string> &depfi
8282
getDeps("lib" + filename.substr(filename.find('/')), depfiles);
8383
else if (startsWith(filename, "test/"))
8484
getDeps("cli" + filename.substr(filename.find('/')), depfiles);
85-
else if (startsWith(filename, "tools/"))
85+
else if (startsWith(filename, "tools"))
8686
getDeps("cli" + filename.substr(filename.find('/')), depfiles);
8787
else if (startsWith(filename, "lib/")) {
8888
for (const std::string & external : externalfolders)
@@ -306,7 +306,7 @@ int main(int argc, char **argv)
306306
}
307307

308308
std::vector<std::string> toolsfiles;
309-
err = getCppFiles(toolsfiles, "tools/", false);
309+
err = getCppFiles(toolsfiles, "tools/dmake/", false);
310310
if (!err.empty()) {
311311
std::cerr << err << std::endl;
312312
return EXIT_FAILURE;
@@ -442,7 +442,7 @@ int main(int argc, char **argv)
442442
return EXIT_FAILURE;
443443
}
444444

445-
fout << "# This file is generated by tools/dmake, do not edit.\n\n";
445+
fout << "# This file is generated by dmake, do not edit.\n\n";
446446

447447
fout << "ifndef VERBOSE\n"
448448
<< " VERBOSE=\n"
@@ -671,7 +671,7 @@ int main(int argc, char **argv)
671671
fout << "\t./testrunner -q\n\n";
672672
fout << "checkcfg:\tcppcheck validateCFG\n";
673673
fout << "\t./test/cfg/runtests.sh\n\n";
674-
fout << "dmake:\ttools/dmake.o cli/filelister.o $(libcppdir)/pathmatch.o $(libcppdir)/path.o $(libcppdir)/utils.o externals/simplecpp/simplecpp.o\n";
674+
fout << "dmake:\ttools/dmake/dmake.o cli/filelister.o $(libcppdir)/pathmatch.o $(libcppdir)/path.o $(libcppdir)/utils.o externals/simplecpp/simplecpp.o\n";
675675
fout << "\t$(CXX) $(CXXFLAGS) -o $@ $^ $(LDFLAGS)\n\n";
676676
fout << "run-dmake: dmake\n";
677677
fout << "\t./dmake" << (release ? " --release" : "") << "\n\n"; // Make CI in release builds happy
File renamed without changes.

Diff for: tools/readme.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ void f2() {
4949
```
5050
From this we can see that the usage of `Token::Match()` in `f1()` has been optimized, whereas the one in `f2()` couldn't be optimized (the string wasn't inline on the `Token::Match()` call). **The developer doesn't need to use this tool during development but should be aware of these optimizations**. *Building with this optimization, cppcheck can get a boost of 2x of speed-up.*
5151
52-
### * tools/dmake.cpp
52+
### * tools/dmake/dmake.cpp
5353
5454
Automatically generates the main `Makefile` for Cppcheck (**the main `Makefile` should not be modified manually**). To build and run the `dmake` tool execute:
5555
```shell

0 commit comments

Comments
 (0)