Skip to content

Commit

Permalink
Merge pull request #608 from roydmerkel/windows-build-fix
Browse files Browse the repository at this point in the history
Fixed windows cmd build (LIB overrides msvc-clang/clang-cl libpath.)
  • Loading branch information
LIJI32 authored Apr 13, 2024
2 parents 5d06f45 + 2ea0932 commit 038a2c5
Showing 1 changed file with 4 additions and 4 deletions.
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

0 comments on commit 038a2c5

Please sign in to comment.