From 264b817b8eb1bf626ade1db6c200f2fa91358331 Mon Sep 17 00:00:00 2001 From: Pieter du Preez Date: Sun, 14 Feb 2016 11:12:06 +0100 Subject: Define the newlib version macros in one place: _newlib_version.h. Currently, the newlib version information needs to be updated in two places: - newlib/acinclude.m4 - newlib/libc/include/sys/features.h The goal of this patch is to: - supply a single location for defining the newlib version information: newlib/acinclude.m4 - define __NEWLIB__, __NEWLIB_MINOR__ and __NEWLIB_PATCHLEVEL__ This is in line with what gcc does for its version macros. See: https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html This patch moves the definition of the _NEWLIB_VERSION, __NEWLIB__ and __NEWLIB_MINOR__ macros from newlib/libc/include/sys/features.h, to the newly generated newlib/_newlib_version.h file. Additionally, the __NEWLIB_PATCHLEVEL__ macro was created, for completeness. In order to stay backwards compatible, newlib/_newlib_version.h gets included by newlib/newlib.h and newlib/libc/include/sys/features.h. Note: This patch does _not_ include the modifications to the following files, as these should all be generated any way. *Makefile.in, *aclocal.m4, *configure stamp-* files Signed-off-by: Pieter du Preez --- newlib/Makefile.am | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'newlib/Makefile.am') diff --git a/newlib/Makefile.am b/newlib/Makefile.am index 5ecce4c10..9b30cd33e 100644 --- a/newlib/Makefile.am +++ b/newlib/Makefile.am @@ -191,7 +191,19 @@ crt1.o: $(CRT1_DIR)$(CRT1) $(CRT1_DIR)$(CRT1): ; @true -$(srcdir)/newlib.hin: +targ-include: + mkdir $@ + +targ-include/newlib.h: targ-include/_newlib_version.h + +targ-include/sys targ-include/machine targ-include/bits: targ-include/_newlib_version.h targ-include/newlib.h + mkdir $@ + +targ-include/newlib.h: newlib.h targ-include + cp newlib.h $@ + +targ-include/_newlib_version.h: _newlib_version.h targ-include + cp _newlib_version.h $@ all-recursive: stmp-targ-include @@ -200,8 +212,10 @@ all-recursive: stmp-targ-include # used while building. stmp-targ-include: config.status -rm -rf targ-include stmp-targ-include - mkdir targ-include targ-include/sys targ-include/machine targ-include/bits - cp newlib.h targ-include/newlib.h + $(MAKE) targ-include/sys \ + targ-include/machine \ + targ-include/bits \ + targ-include/newlib.h -for i in $(srcdir)/libc/machine/$(machine_dir)/machine/*.h; do \ if [ -f $$i ]; then \ cp $$i targ-include/machine/`basename $$i`; \ @@ -274,6 +288,7 @@ endif $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/`basename $$i`; \ done; \ $(INSTALL_DATA) newlib.h $(DESTDIR)$(tooldir)/include/newlib.h; \ + $(INSTALL_DATA) _newlib_version.h $(DESTDIR)$(tooldir)/include/_newlib_version.h; \ $(mkinstalldirs) $(DESTDIR)$(tooldir)/include/machine; \ for i in $(srcdir)/libc/include/machine/*.h; do \ $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/machine/`basename $$i`; \ @@ -441,4 +456,4 @@ check-DEJAGNU: site.exp fi clean-local: - -rm -rf targ-include + -rm -rf targ-include newlib.h _newlib_version.h stamp-* -- cgit v1.2.3