From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2134) id 16F803858D33; Wed, 22 Feb 2023 21:02:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 16F803858D33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1677099775; bh=Se8xgvj4rISenV88Sh7sfwHyiwjHUQgdjfVVGvsW+Xo=; h=From:To:Subject:Date:From; b=Qgrv3Wx+ZxWkz+lQUyaUD+uWd6CdXNx/fuYEfHfUd+n7Mtux+pmAL8qqobNUZjdnQ dTvx9W13LAStSbZO/5A6RvzBM+i7J64qJKc4egxp1aHr35s3ELt7QBRVyEy+FWZvKY KRgCSRi58yKp7me/lgbDtF92kFI7HlCW3E5Z1qKQ= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Jeff Johnston To: newlib-cvs@sourceware.org Subject: [newlib-cygwin] Fix libgloss/newlib build to conditionally use top include dir X-Act-Checkin: newlib-cygwin X-Git-Author: Jeff Johnston X-Git-Refname: refs/heads/master X-Git-Oldrev: 97d483c2f81c0865bead701f4d2824a21fae4938 X-Git-Newrev: 17ac400c11bab30ac2c0bef12cbf7788f0b6f954 Message-Id: <20230222210255.16F803858D33@sourceware.org> Date: Wed, 22 Feb 2023 21:02:55 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3D17ac400c11b= ab30ac2c0bef12cbf7788f0b6f954 commit 17ac400c11bab30ac2c0bef12cbf7788f0b6f954 Author: Jeff Johnston Date: Thu Feb 9 16:59:31 2023 -0500 Fix libgloss/newlib build to conditionally use top include dir =20 - conditionally use -idirafter option for arm Diff: --- libgloss/Makefile.am | 4 ++++ libgloss/Makefile.in | 3 ++- libgloss/config/arm.mh | 34 ++++++++++++++++++++++++++++++++++ libgloss/config/default.mh | 2 +- libgloss/configure | 16 ++++++++++++++++ libgloss/configure.ac | 4 ++++ newlib/Makefile.am | 4 ++++ newlib/Makefile.in | 3 ++- 8 files changed, 67 insertions(+), 3 deletions(-) diff --git a/libgloss/Makefile.am b/libgloss/Makefile.am index 4309cd3a4..d4b7d4077 100644 --- a/libgloss/Makefile.am +++ b/libgloss/Makefile.am @@ -24,7 +24,11 @@ includetool_DATA =3D includesystooldir =3D $(tooldir)/include/sys includesystool_DATA =3D =20 +if NEED_TOP_INCLUDE_DIR AM_CPPFLAGS =3D -idirafter $(srcroot)/include +else +AM_CPPFLAGS =3D +endif =20 # A fake library so automake will generate rules for plain objects that we= want # to install (e.g. our crt0.o objects). diff --git a/libgloss/Makefile.in b/libgloss/Makefile.in index a117577ea..187d0edb0 100644 --- a/libgloss/Makefile.in +++ b/libgloss/Makefile.in @@ -807,7 +807,8 @@ includetooldir =3D $(tooldir)/include includetool_DATA =3D $(am__append_16) includesystooldir =3D $(tooldir)/include/sys includesystool_DATA =3D $(am__append_17) -AM_CPPFLAGS =3D -idirafter $(srcroot)/include +@NEED_TOP_INCLUDE_DIR_FALSE@AM_CPPFLAGS =3D=20 +@NEED_TOP_INCLUDE_DIR_TRUE@AM_CPPFLAGS =3D -idirafter $(srcroot)/include =20 # A fake library so automake will generate rules for plain objects that we= want # to install (e.g. our crt0.o objects). diff --git a/libgloss/config/arm.mh b/libgloss/config/arm.mh new file mode 100644 index 000000000..81f0920f9 --- /dev/null +++ b/libgloss/config/arm.mh @@ -0,0 +1,34 @@ +NEWLIB_CFLAGS =3D `if [ -d ${objroot}/newlib ]; then echo -I${objroot}/new= lib/targ-include -I${srcroot}/newlib/libc/include; fi` +NEWLIB_LDFLAGS =3D `if [ -d ${objroot}/newlib ]; then echo -B${objroot}/ne= wlib/ -L${objroot}/newlib/; fi` + +INCLUDES =3D -I. -I$(srcdir)/.. -I$(objdir)/.. -idirafter $(srcroot)/inclu= de +# Note that when building the library, ${MULTILIB} is not the way multilib +# options are passed; they're passed in $(CFLAGS). +CFLAGS_FOR_TARGET =3D -O2 -g ${MULTILIB} ${INCLUDES} ${NEWLIB_CFLAGS} +LDFLAGS_FOR_TARGET =3D ${MULTILIB} ${NEWLIB_LDFLAGS} +AR_FLAGS =3D rc + +.c.o: + $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $< + +.C.o: + $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $< +.s.o: + $(AS) $(ASFLAGS_FOR_TARGET) $(INCLUDES) $(ASFLAGS) -o $*.o $< + +# +# GCC knows to run the preprocessor on .S files before it assembles them. +# +.S.o: + $(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) $(CFLAGS) -c $< + +# +# this is a bogus target that'll produce an assembler from the +# C source with the right compiler options. this is so we can +# track down code generation or debug symbol bugs. +# +.c.s: + $(CC) $(CFLAGS_FOR_TARGET) -S $(INCLUDES) $(CFLAGS) $< + +# We don't build docs in subdirs, so stub out the rules. +.PHONY: doc docs dvi html install-html info install-info clean-info pdf in= stall-pdf diff --git a/libgloss/config/default.mh b/libgloss/config/default.mh index 81f0920f9..4e7f106f9 100644 --- a/libgloss/config/default.mh +++ b/libgloss/config/default.mh @@ -1,7 +1,7 @@ NEWLIB_CFLAGS =3D `if [ -d ${objroot}/newlib ]; then echo -I${objroot}/new= lib/targ-include -I${srcroot}/newlib/libc/include; fi` NEWLIB_LDFLAGS =3D `if [ -d ${objroot}/newlib ]; then echo -B${objroot}/ne= wlib/ -L${objroot}/newlib/; fi` =20 -INCLUDES =3D -I. -I$(srcdir)/.. -I$(objdir)/.. -idirafter $(srcroot)/inclu= de +INCLUDES =3D -I. -I$(srcdir)/.. -I$(objdir)/.. # Note that when building the library, ${MULTILIB} is not the way multilib # options are passed; they're passed in $(CFLAGS). CFLAGS_FOR_TARGET =3D -O2 -g ${MULTILIB} ${INCLUDES} ${NEWLIB_CFLAGS} diff --git a/libgloss/configure b/libgloss/configure index 28754b6d5..c07610411 100755 --- a/libgloss/configure +++ b/libgloss/configure @@ -630,6 +630,8 @@ CPPFLAGS LDFLAGS CFLAGS CC +NEED_TOP_INCLUDE_DIR_FALSE +NEED_TOP_INCLUDE_DIR_TRUE CONFIG_WINCE_FALSE CONFIG_WINCE_TRUE CONFIG_RISCV_FALSE @@ -2949,6 +2951,7 @@ case "${target}" in ;; arm*-*-elf | arm*-*-coff | arm*-*-*) config_arm=3Dtrue + host_makefile_frag=3D${srcdir}/config/arm.mh ;; spu-*-elf) ac_config_files=3D"$ac_config_files spu/Makefile" @@ -3081,6 +3084,15 @@ fi =20 =20 =20 + if test x$config_arm =3D xtrue; then + NEED_TOP_INCLUDE_DIR_TRUE=3D + NEED_TOP_INCLUDE_DIR_FALSE=3D'#' +else + NEED_TOP_INCLUDE_DIR_TRUE=3D'#' + NEED_TOP_INCLUDE_DIR_FALSE=3D +fi + + =20 ac_ext=3Dc ac_cpp=3D'$CPP $CPPFLAGS' @@ -5347,6 +5359,10 @@ if test -z "${CONFIG_WINCE_TRUE}" && test -z "${CONF= IG_WINCE_FALSE}"; then as_fn_error $? "conditional \"CONFIG_WINCE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${NEED_TOP_INCLUDE_DIR_TRUE}" && test -z "${NEED_TOP_INCLUDE_D= IR_FALSE}"; then + as_fn_error $? "conditional \"NEED_TOP_INCLUDE_DIR\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then as_fn_error $? "conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 diff --git a/libgloss/configure.ac b/libgloss/configure.ac index 5fb26845c..a332193ce 100644 --- a/libgloss/configure.ac +++ b/libgloss/configure.ac @@ -214,6 +214,7 @@ case "${target}" in ;; arm*-*-elf | arm*-*-coff | arm*-*-*) config_arm=3Dtrue + host_makefile_frag=3D${srcdir}/config/arm.mh ;; spu-*-elf) AC_CONFIG_FILES([spu/Makefile]) @@ -252,6 +253,9 @@ m4_foreach_w([SUBDIR], [ AM_CONDITIONAL([CONFIG_]m4_toupper(SUBDIR), [test x$config_]SUBDIR =3D x= true) ]) =20 +dnl arm platforms have a special header file found in the main include dir= ectory +AM_CONDITIONAL([NEED_TOP_INCLUDE_DIR], [[test x$config_arm] =3D xtrue]) + dnl For now, don't bother configuring testsuite dnl dnl if test "${config_testsuite}" =3D "true"; diff --git a/newlib/Makefile.am b/newlib/Makefile.am index 3bebf27eb..a188845d6 100644 --- a/newlib/Makefile.am +++ b/newlib/Makefile.am @@ -70,7 +70,11 @@ toollibdir =3D $(tooldir)/lib$(MULTISUBDIR) # These are useful for standalone object files like crt0.o. AM_CFLAGS =3D $(AM_CFLAGS_$(subst /,_,$(@D))) $(AM_CFLAGS_$(subst /,_,$(@D= )_$(