Merge pull request #2031 from GriffinRichards/fix-toolchain

Minor toolchain fixes
This commit is contained in:
GriffinR 2024-09-19 12:23:58 -04:00 committed by GitHub
commit 473e0623ba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 27 additions and 26 deletions

View file

@ -4,6 +4,7 @@ GAME_CODE := BPEE
MAKER_CODE := 01 MAKER_CODE := 01
REVISION := 0 REVISION := 0
MODERN ?= 0 MODERN ?= 0
KEEP_TEMPS ?= 0
# `File name`.gba ('_modern' will be appended to the modern builds) # `File name`.gba ('_modern' will be appended to the modern builds)
FILE_NAME := pokeemerald FILE_NAME := pokeemerald
@ -256,18 +257,18 @@ include audio_rules.mk
generated: $(AUTO_GEN_TARGETS) generated: $(AUTO_GEN_TARGETS)
%.s: ; %.s: ;
%.png: ; %.png: ;
%.pal: ; %.pal: ;
%.aif: ; %.aif: ;
%.1bpp: %.png ; $(GFX) $< $@ %.1bpp: %.png ; $(GFX) $< $@
%.4bpp: %.png ; $(GFX) $< $@ %.4bpp: %.png ; $(GFX) $< $@
%.8bpp: %.png ; $(GFX) $< $@ %.8bpp: %.png ; $(GFX) $< $@
%.gbapal: %.pal ; $(GFX) $< $@ %.gbapal: %.pal ; $(GFX) $< $@
%.gbapal: %.png ; $(GFX) $< $@ %.gbapal: %.png ; $(GFX) $< $@
%.lz: % ; $(GFX) $< $@ %.lz: % ; $(GFX) $< $@
%.rl: % ; $(GFX) $< $@ %.rl: % ; $(GFX) $< $@
# NOTE: Tools must have been built prior (FIXME) # NOTE: Tools must have been built prior (FIXME)
generated: tools $(AUTO_GEN_TARGETS) generated: tools $(AUTO_GEN_TARGETS)
@ -305,7 +306,7 @@ endef
# $1: Output file without extension, $2 input file, $3 temp path (if keeping) # $1: Output file without extension, $2 input file, $3 temp path (if keeping)
define C_DEP_IMPL define C_DEP_IMPL
$1.o: $2 $1.o: $2
ifeq (,$(KEEP_TEMPS)) ifneq ($(KEEP_TEMPS),1)
@echo "$$(CC1) <flags> -o $$@ $$<" @echo "$$(CC1) <flags> -o $$@ $$<"
@$$(CPP) $$(CPPFLAGS) $$< | $$(PREPROC) -i $$< charmap.txt | $$(CC1) $$(CFLAGS) -o - - | cat - <(echo -e ".text\n\t.align\t2, 0") | $$(AS) $$(ASFLAGS) -o $$@ - @$$(CPP) $$(CPPFLAGS) $$< | $$(PREPROC) -i $$< charmap.txt | $$(CC1) $$(CFLAGS) -o - - | cat - <(echo -e ".text\n\t.align\t2, 0") | $$(AS) $$(ASFLAGS) -o $$@ -
else else
@ -314,15 +315,11 @@ else
@echo -e ".text\n\t.align\t2, 0\n" >> $3.s @echo -e ".text\n\t.align\t2, 0\n" >> $3.s
$$(AS) $$(ASFLAGS) -o $$@ $3.s $$(AS) $$(ASFLAGS) -o $$@ $3.s
endif 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 $1.d: $2
$(SCANINC) -M $1.d $(INCLUDE_SCANINC_ARGS) -I tools/agbcc/include $2 $(SCANINC) -M $1.d $(INCLUDE_SCANINC_ARGS) -I tools/agbcc/include $2
include $1.d ifneq ($(NODEP),1)
$1.o: $1.d
-include $1.d
endif endif
endef endef
@ -352,7 +349,7 @@ ifneq ($(NODEP),1)
$1.o: $1.d $1.o: $1.d
$1.d: $2 $1.d: $2
$(SCANINC) -M $1.d $(INCLUDE_SCANINC_ARGS) -I "" $2 $(SCANINC) -M $1.d $(INCLUDE_SCANINC_ARGS) -I "" $2
include $1.d -include $1.d
endif endif
endef endef

View file

@ -33,7 +33,6 @@ using std::vector;
using std::map; using std::map;
using std::make_shared; using std::make_shared;
using std::initializer_list; using std::initializer_list;
using std::move;
/* Helper for representing null - just a do-nothing struct, plus comparison /* 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 * operators so the helpers in JsonValue work. We can't use nullptr_t because
@ -149,7 +148,7 @@ protected:
// Constructors // Constructors
explicit Value(const T &value) : m_value(value) {} 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 // Get type tag
Json::Type type() const override { Json::Type type() const override {
@ -196,7 +195,7 @@ class JsonString final : public Value<Json::STRING, string> {
const string &string_value() const override { return m_value; } const string &string_value() const override { return m_value; }
public: public:
explicit JsonString(const string &value) : Value(value) {} 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<Json::ARRAY, Json::array> { class JsonArray final : public Value<Json::ARRAY, Json::array> {
@ -204,7 +203,7 @@ class JsonArray final : public Value<Json::ARRAY, Json::array> {
const Json & operator[](size_t i) const override; const Json & operator[](size_t i) const override;
public: public:
explicit JsonArray(const Json::array &value) : Value(value) {} 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<Json::OBJECT, Json::object> { class JsonObject final : public Value<Json::OBJECT, Json::object> {
@ -212,7 +211,7 @@ class JsonObject final : public Value<Json::OBJECT, Json::object> {
const Json & operator[](const string &key) const override; const Json & operator[](const string &key) const override;
public: public:
explicit JsonObject(const Json::object &value) : Value(value) {} 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<Json::NUL, NullStruct> { class JsonNull final : public Value<Json::NUL, NullStruct> {
@ -254,12 +253,12 @@ Json::Json(double value) : m_ptr(make_shared<JsonDouble>(value)) {
Json::Json(int value) : m_ptr(make_shared<JsonInt>(value)) {} Json::Json(int value) : m_ptr(make_shared<JsonInt>(value)) {}
Json::Json(bool value) : m_ptr(value ? statics().t : statics().f) {} Json::Json(bool value) : m_ptr(value ? statics().t : statics().f) {}
Json::Json(const string &value) : m_ptr(make_shared<JsonString>(value)) {} Json::Json(const string &value) : m_ptr(make_shared<JsonString>(value)) {}
Json::Json(string &&value) : m_ptr(make_shared<JsonString>(move(value))) {} Json::Json(string &&value) : m_ptr(make_shared<JsonString>(std::move(value))) {}
Json::Json(const char * value) : m_ptr(make_shared<JsonString>(value)) {} Json::Json(const char * value) : m_ptr(make_shared<JsonString>(value)) {}
Json::Json(const Json::array &values) : m_ptr(make_shared<JsonArray>(values)) {} Json::Json(const Json::array &values) : m_ptr(make_shared<JsonArray>(values)) {}
Json::Json(Json::array &&values) : m_ptr(make_shared<JsonArray>(move(values))) {} Json::Json(Json::array &&values) : m_ptr(make_shared<JsonArray>(std::move(values))) {}
Json::Json(const Json::object &values) : m_ptr(make_shared<JsonObject>(values)) {} Json::Json(const Json::object &values) : m_ptr(make_shared<JsonObject>(values)) {}
Json::Json(Json::object &&values) : m_ptr(make_shared<JsonObject>(move(values))) {} Json::Json(Json::object &&values) : m_ptr(make_shared<JsonObject>(std::move(values))) {}
/* * * * * * * * * * * * * * * * * * * * /* * * * * * * * * * * * * * * * * * * *
* Accessors * Accessors
@ -357,7 +356,7 @@ struct JsonParser final {
* Mark this parse as failed. * Mark this parse as failed.
*/ */
Json fail(string &&msg) { Json fail(string &&msg) {
return fail(move(msg), Json()); return fail(std::move(msg), Json());
} }
template <typename T> template <typename T>

View file

@ -125,7 +125,12 @@ int main(int argc, char **argv)
if (!exists && (file.FileType() == SourceFileType::Asm || file.FileType() == SourceFileType::Inc)) if (!exists && (file.FileType() == SourceFileType::Asm || file.FileType() == SourceFileType::Inc))
{ {
path = include; path = include;
if (CanOpenFile(path))
exists = true;
} }
if (!exists)
continue;
dependencies_includes.insert(path); dependencies_includes.insert(path);
bool inserted = dependencies.insert(path).second; bool inserted = dependencies.insert(path).second;
if (inserted && exists) if (inserted && exists)