From b02d37836f4aca3a75d0347d9a7d66f1df3b7f7c Mon Sep 17 00:00:00 2001 From: Ash Logan Date: Tue, 23 Apr 2019 20:37:17 +1000 Subject: [PATCH] Makefile: Generate stub cafe libraries w/ .gnu.warning sections --- Makefile | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index be49809..b9c35e8 100644 --- a/Makefile +++ b/Makefile @@ -88,6 +88,8 @@ export OFILES_SRC := $(DEFFILES:.def=.o) $(SFILES:.s=.o) $(CFILES:.c=.o) $(CPPFI export OFILES := $(OFILES_BIN) $(OFILES_SRC) export HFILES := $(addsuffix .h,$(subst .,_,$(BINFILES))) +export STUB_LIBS := $(addprefix lib/stubs/lib,$(DEFFILES:.def=.a)) lib/stubs/libnn_swkbd.a lib/stubs/libwhb.a lib/stubs/libgfd.a + export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ -I. @@ -95,7 +97,7 @@ export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ .PHONY: all dist-bin dist-src dist install clean #--------------------------------------------------------------------------------- -all: lib/libwut.a lib/libwutd.a +all: lib/libwut.a lib/libwutd.a $(STUB_LIBS) dist-bin: all @tar --exclude=*~ -cjf wut-$(VERSION).tar.bz2 include lib share -C libraries/libwhb include -C ../libgfd include @@ -112,6 +114,9 @@ install: dist-bin lib: @[ -d $@ ] || mkdir -p $@ +lib/stubs: + @[ -d $@ ] || mkdir -p $@ + release: @[ -d $@ ] || mkdir -p $@ @@ -132,6 +137,13 @@ lib/libwutd.a : $(SOURCES) $(INCLUDES) | lib debug --no-print-directory -C debug \ -f $(CURDIR)/Makefile +# temp: Deprecation stub for directly linking cafe libs (all in libwut) +lib/stubs/lib%.a: | lib/stubs release + @echo stub $(notdir $*) + @echo "static const char w[] __attribute__((section(\".gnu.warning\"))) = \"Deprecation: Linking to Cafe libraries (-l$*) is no longer needed, and will be removed in future. Please update your build.\";" > release/$*.stub.c + @$(CC) $(MACHDEP) -Wno-unused-variable -c release/$*.stub.c -o release/$*.stub.o $(ERROR_FILTER) + @$(AR) -rc $@ release/$*.stub.o + #--------------------------------------------------------------------------------- clean: @echo clean ... @@ -161,4 +173,3 @@ $(OFILES_SRC) : $(HFILES) #--------------------------------------------------------------------------------------- endif #--------------------------------------------------------------------------------------- -