summaryrefslogtreecommitdiff
path: root/tools/scaninc
diff options
context:
space:
mode:
authorshinny <shinny456@users.noreply.github.com>2020-06-02 14:51:57 -0400
committershinny <shinny456@users.noreply.github.com>2020-06-02 14:51:57 -0400
commit4f88655a79bb2d8f10bdce2841f427c0e27040bd (patch)
treeb750e64b62cec61ca3a43da6aa7d4e3b37e64c9e /tools/scaninc
parentbc504264f1e54b3c1e482710c592e5549828bfe1 (diff)
update tools
Diffstat (limited to 'tools/scaninc')
-rw-r--r--tools/scaninc/Makefile7
-rw-r--r--tools/scaninc/scaninc.cpp19
-rw-r--r--tools/scaninc/source_file.cpp5
-rw-r--r--tools/scaninc/source_file.h1
4 files changed, 24 insertions, 8 deletions
diff --git a/tools/scaninc/Makefile b/tools/scaninc/Makefile
index 53c9d00..52e663d 100644
--- a/tools/scaninc/Makefile
+++ b/tools/scaninc/Makefile
@@ -1,4 +1,4 @@
-CXX = g++
+CXX ?= g++
CXXFLAGS = -Wall -Werror -std=c++11 -O2
@@ -6,7 +6,10 @@ SRCS = scaninc.cpp c_file.cpp asm_file.cpp source_file.cpp
HEADERS := scaninc.h asm_file.h c_file.h source_file.h
-.PHONY: clean
+.PHONY: all clean
+
+all: scaninc
+ @:
scaninc: $(SRCS) $(HEADERS)
$(CXX) $(CXXFLAGS) $(SRCS) -o $@ $(LDFLAGS)
diff --git a/tools/scaninc/scaninc.cpp b/tools/scaninc/scaninc.cpp
index b95cbd0..a3e40c5 100644
--- a/tools/scaninc/scaninc.cpp
+++ b/tools/scaninc/scaninc.cpp
@@ -97,19 +97,26 @@ int main(int argc, char **argv)
}
for (auto include : file.GetIncludes())
{
+ bool exists = false;
+ std::string path("");
for (auto includeDir : includeDirs)
{
- std::string path(includeDir + include);
+ path = includeDir + include;
if (CanOpenFile(path))
{
- bool inserted = dependencies.insert(path).second;
- if (inserted)
- {
- filesToProcess.push(path);
- }
+ exists = true;
break;
}
}
+ if (!exists && file.FileType() == SourceFileType::Asm)
+ {
+ path = include;
+ }
+ bool inserted = dependencies.insert(path).second;
+ if (inserted && exists)
+ {
+ filesToProcess.push(path);
+ }
}
includeDirs.pop_back();
}
diff --git a/tools/scaninc/source_file.cpp b/tools/scaninc/source_file.cpp
index f23ff6d..df31282 100644
--- a/tools/scaninc/source_file.cpp
+++ b/tools/scaninc/source_file.cpp
@@ -89,6 +89,11 @@ SourceFile::SourceFile(std::string path)
}
}
+SourceFileType SourceFile::FileType()
+{
+ return m_file_type;
+}
+
SourceFile::~SourceFile()
{
if (m_file_type == SourceFileType::Cpp || m_file_type == SourceFileType::Header)
diff --git a/tools/scaninc/source_file.h b/tools/scaninc/source_file.h
index f7b6412..854b3f1 100644
--- a/tools/scaninc/source_file.h
+++ b/tools/scaninc/source_file.h
@@ -50,6 +50,7 @@ public:
const std::set<std::string>& GetIncbins();
const std::set<std::string>& GetIncludes();
std::string& GetSrcDir();
+ SourceFileType FileType();
private:
union InnerUnion {