From b8c71fa84d7d590006b94b0b5b46aa9a74cf2f41 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Fri, 13 Sep 2024 23:38:50 -0400 Subject: [PATCH 1/2] Fix .d files not updating if .o fails, fix clean rule, remove some unnecessary warnings --- Makefile | 31 ++++++++++++++----------------- tools/mapjson/json11.cpp | 17 ++++++++--------- 2 files changed, 22 insertions(+), 26 deletions(-) diff --git a/Makefile b/Makefile index ce868f06bd..48350147a4 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,7 @@ GAME_CODE := BPEE MAKER_CODE := 01 REVISION := 0 MODERN ?= 0 +KEEP_TEMPS ?= 0 # `File name`.gba ('_modern' will be appended to the modern builds) FILE_NAME := pokeemerald @@ -261,18 +262,18 @@ include audio_rules.mk generated: $(AUTO_GEN_TARGETS) -%.s: ; +%.s: ; %.png: ; %.pal: ; %.aif: ; -%.1bpp: %.png ; $(GFX) $< $@ -%.4bpp: %.png ; $(GFX) $< $@ -%.8bpp: %.png ; $(GFX) $< $@ -%.gbapal: %.pal ; $(GFX) $< $@ -%.gbapal: %.png ; $(GFX) $< $@ -%.lz: % ; $(GFX) $< $@ -%.rl: % ; $(GFX) $< $@ +%.1bpp: %.png ; $(GFX) $< $@ +%.4bpp: %.png ; $(GFX) $< $@ +%.8bpp: %.png ; $(GFX) $< $@ +%.gbapal: %.pal ; $(GFX) $< $@ +%.gbapal: %.png ; $(GFX) $< $@ +%.lz: % ; $(GFX) $< $@ +%.rl: % ; $(GFX) $< $@ # NOTE: Tools must have been built prior (FIXME) generated: tools $(AUTO_GEN_TARGETS) @@ -310,7 +311,7 @@ endef # $1: Output file without extension, $2 input file, $3 temp path (if keeping) define C_DEP_IMPL $1.o: $2 -ifeq (,$(KEEP_TEMPS)) +ifneq ($(KEEP_TEMPS),1) @echo "$$(CC1) -o $$@ $$<" @$$(CPP) $$(CPPFLAGS) $$< | $$(PREPROC) -i $$< charmap.txt | $$(CC1) $$(CFLAGS) -o - - | cat - <(echo -e ".text\n\t.align\t2, 0") | $$(AS) $$(ASFLAGS) -o $$@ - else @@ -319,15 +320,11 @@ else @echo -e ".text\n\t.align\t2, 0\n" >> $3.s $$(AS) $$(ASFLAGS) -o $$@ $3.s endif -$(call C_SCANINC,$1,$2) -endef -# Calls SCANINC to find dependencies -define C_SCANINC -ifneq ($(NODEP),1) -$1.o: $1.d $1.d: $2 $(SCANINC) -M $1.d $(INCLUDE_SCANINC_ARGS) -I tools/agbcc/include -I gflib $2 -include $1.d +ifneq ($(NODEP),1) +$1.o: $1.d +-include $1.d endif endef @@ -359,7 +356,7 @@ ifneq ($(NODEP),1) $1.o: $1.d $1.d: $2 $(SCANINC) -M $1.d $(INCLUDE_SCANINC_ARGS) -I "" $2 -include $1.d +-include $1.d endif endef diff --git a/tools/mapjson/json11.cpp b/tools/mapjson/json11.cpp index 1da530206b..3ac5f392a0 100644 --- a/tools/mapjson/json11.cpp +++ b/tools/mapjson/json11.cpp @@ -33,7 +33,6 @@ using std::vector; using std::map; using std::make_shared; using std::initializer_list; -using std::move; /* Helper for representing null - just a do-nothing struct, plus comparison * operators so the helpers in JsonValue work. We can't use nullptr_t because @@ -149,7 +148,7 @@ protected: // Constructors explicit Value(const T &value) : m_value(value) {} - explicit Value(T &&value) : m_value(move(value)) {} + explicit Value(T &&value) : m_value(std::move(value)) {} // Get type tag Json::Type type() const override { @@ -196,7 +195,7 @@ class JsonString final : public Value { const string &string_value() const override { return m_value; } public: explicit JsonString(const string &value) : Value(value) {} - explicit JsonString(string &&value) : Value(move(value)) {} + explicit JsonString(string &&value) : Value(std::move(value)) {} }; class JsonArray final : public Value { @@ -204,7 +203,7 @@ class JsonArray final : public Value { const Json & operator[](size_t i) const override; public: explicit JsonArray(const Json::array &value) : Value(value) {} - explicit JsonArray(Json::array &&value) : Value(move(value)) {} + explicit JsonArray(Json::array &&value) : Value(std::move(value)) {} }; class JsonObject final : public Value { @@ -212,7 +211,7 @@ class JsonObject final : public Value { const Json & operator[](const string &key) const override; public: explicit JsonObject(const Json::object &value) : Value(value) {} - explicit JsonObject(Json::object &&value) : Value(move(value)) {} + explicit JsonObject(Json::object &&value) : Value(std::move(value)) {} }; class JsonNull final : public Value { @@ -254,12 +253,12 @@ Json::Json(double value) : m_ptr(make_shared(value)) { Json::Json(int value) : m_ptr(make_shared(value)) {} Json::Json(bool value) : m_ptr(value ? statics().t : statics().f) {} Json::Json(const string &value) : m_ptr(make_shared(value)) {} -Json::Json(string &&value) : m_ptr(make_shared(move(value))) {} +Json::Json(string &&value) : m_ptr(make_shared(std::move(value))) {} Json::Json(const char * value) : m_ptr(make_shared(value)) {} Json::Json(const Json::array &values) : m_ptr(make_shared(values)) {} -Json::Json(Json::array &&values) : m_ptr(make_shared(move(values))) {} +Json::Json(Json::array &&values) : m_ptr(make_shared(std::move(values))) {} Json::Json(const Json::object &values) : m_ptr(make_shared(values)) {} -Json::Json(Json::object &&values) : m_ptr(make_shared(move(values))) {} +Json::Json(Json::object &&values) : m_ptr(make_shared(std::move(values))) {} /* * * * * * * * * * * * * * * * * * * * * Accessors @@ -357,7 +356,7 @@ struct JsonParser final { * Mark this parse as failed. */ Json fail(string &&msg) { - return fail(move(msg), Json()); + return fail(std::move(msg), Json()); } template From 302193a814ffcf12fa2a5c394ce2ce85e6c49250 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Fri, 13 Sep 2024 23:40:00 -0400 Subject: [PATCH 2/2] Have scaninc ignore non-existing files --- tools/scaninc/scaninc.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/scaninc/scaninc.cpp b/tools/scaninc/scaninc.cpp index f5ee7ad6de..c1b7987a5a 100644 --- a/tools/scaninc/scaninc.cpp +++ b/tools/scaninc/scaninc.cpp @@ -125,7 +125,12 @@ int main(int argc, char **argv) if (!exists && (file.FileType() == SourceFileType::Asm || file.FileType() == SourceFileType::Inc)) { path = include; + if (CanOpenFile(path)) + exists = true; } + if (!exists) + continue; + dependencies_includes.insert(path); bool inserted = dependencies.insert(path).second; if (inserted && exists)