Makefile: Generate stub cafe libraries w/ .gnu.warning sections

This commit is contained in:
Ash Logan 2019-04-23 20:37:17 +10:00
parent 6aac84dc6f
commit b02d37836f

View File

@ -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
#---------------------------------------------------------------------------------------