Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed windows cmd build (LIB overrides msvc-clang/clang-cl libpath.) #608

Merged
merged 1 commit into from
Apr 13, 2024
Merged
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
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ CONF ?= debug
BIN := build/bin
OBJ := build/obj
INC := build/include/sameboy
LIB := build/lib
LIBDIR := build/lib

BOOTROMS_DIR ?= $(BIN)/BootROMs

Expand Down Expand Up @@ -331,7 +331,7 @@ ios-deb: $(BIN)/SameBoy-iOS.deb
ifeq ($(PLATFORM),windows32)
lib: lib-unsupported
else
lib: $(LIB)/libsameboy.o $(LIB)/libsameboy.a
lib: $(LIBDIR)/libsameboy.o $(LIBDIR)/libsameboy.a
endif
all: sdl tester libretro lib
ifeq ($(PLATFORM),Darwin)
Expand Down Expand Up @@ -717,15 +717,15 @@ $(OBJ)/debian-binary:
-@$(MKDIR) -p $(dir $@)
echo 2.0 > $@

$(LIB)/libsameboy.o: $(CORE_OBJECTS)
$(LIBDIR)/libsameboy.o: $(CORE_OBJECTS)
-@$(MKDIR) -p $(dir $@)
@# This is a somewhat simple hack to force Clang and GCC to build a native object file out of one or many LTO objects
echo "static const char __attribute__((used)) x=0;"| $(CC) $(filter-out -flto,$(CFLAGS)) -c -x c - -o $(OBJ)/lto_hack.o
@# And this is a somewhat complicated hack to invoke the correct LTO-enabled LD command in a mostly cross-platform nature
$(CC) $(FAT_FLAGS) $(CFLAGS) $(LIBFLAGS) $^ $(OBJ)/lto_hack.o -o $@
-@rm $(OBJ)/lto_hack.o

$(LIB)/libsameboy.a: $(LIB)/libsameboy.o
$(LIBDIR)/libsameboy.a: $(LIBDIR)/libsameboy.o
-@$(MKDIR) -p $(dir $@)
-@rm -f $@
ar -crs $@ $^
Expand Down