Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -848,6 +848,6 @@ externals/simplecpp/simplecpp.o: externals/simplecpp/simplecpp.cpp externals/sim
externals/tinyxml2/tinyxml2.o: externals/tinyxml2/tinyxml2.cpp externals/tinyxml2/tinyxml2.h
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -w -c -o $@ externals/tinyxml2/tinyxml2.cpp

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

18 changes: 12 additions & 6 deletions tools/dmake.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

#include "../cli/filelister.h"
#include "../lib/pathmatch.h"
#include "../lib/utils.h"

static std::string builddir(std::string filename)
{
Expand Down Expand Up @@ -56,7 +57,7 @@ static std::string objfiles(const std::vector<std::string> &files)

static void getDeps(const std::string &filename, std::vector<std::string> &depfiles)
{
static const std::array<std::string, 4> externalfolders{"externals", "externals/picojson", "externals/simplecpp", "externals/tinyxml2"};
static const std::array<std::string, 3> externalfolders{"externals/picojson", "externals/simplecpp", "externals/tinyxml2"};

// Is the dependency already included?
if (std::find(depfiles.begin(), depfiles.end(), filename) != depfiles.end())
Expand Down Expand Up @@ -102,10 +103,15 @@ static void getDeps(const std::string &filename, std::vector<std::string> &depfi
pos1 += 10;

const std::string::size_type pos2 = line.find(rightBracket, pos1);
std::string hfile = path + line.substr(pos1, pos2 - pos1);

if (hfile.find("/../") != std::string::npos) // TODO: Ugly fix
hfile.erase(0, 4 + hfile.find("/../"));
std::string hfile(path);
hfile += line.substr(pos1, pos2 - pos1);

const std::string::size_type traverse_pos = hfile.find("/../");
if (traverse_pos != std::string::npos) // TODO: Ugly fix
hfile.erase(0, 4 + traverse_pos);
// no need to look up extension-less headers
if (!endsWith(hfile, ".h"))
continue;
getDeps(hfile, depfiles);
}
}
Expand Down Expand Up @@ -136,7 +142,7 @@ static std::string getCppFiles(std::vector<std::string> &files, const std::strin

// add *.cpp files to the "files" vector..
for (const std::pair<const std::string&, size_t> file : filemap) {
if (file.first.find(".cpp") != std::string::npos)
if (endsWith(file.first, ".cpp"))
files.push_back(file.first);
}
return "";
Expand Down