From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com [IPv6:2607:f8b0:4864:20::42b]) by sourceware.org (Postfix) with ESMTPS id 6D7643858D37 for ; Tue, 23 Aug 2022 23:17:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6D7643858D37 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=rivosinc.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=rivosinc.com Received: by mail-pf1-x42b.google.com with SMTP id x15so13971672pfp.4 for ; Tue, 23 Aug 2022 16:17:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; h=to:from:cc:content-transfer-encoding:mime-version:message-id:date :subject:from:to:cc; bh=t+Gxw1FsS+CJ+rz3fpimq85t74N8TlErmgQSp1hPzv4=; b=x+ZqFPgh1KAQP4u9mqCC68LHAKanaFxVQqEww823+gAVkGF2MRehxcfMPvrCPzTHlu qaCDkwlYfoE7k1Zi2HuTK5avTSYHnm6OED5PTZvhrsS6eHBwuApn3bSFTyzg4eyjmvd+ KtUt8c8pYkPHJhJeQ+5Sa6+vVod5XZ0yQRVdMpZY4J273zAqXtySu9autBf2XnsivnTg na9TXIlv2K18QnindeN/pW7uvSdYtbuuiCwrfJOFJLNHr8/QZU35RFOuDltMDcnMsh3f ofzyl6BTK26T0WFapnAubR64XOFayr8KQNEKJC6lqx6M2ywO85asr/BbVpXYA8hROoEk A4HQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:from:cc:content-transfer-encoding:mime-version:message-id:date :subject:x-gm-message-state:from:to:cc; bh=t+Gxw1FsS+CJ+rz3fpimq85t74N8TlErmgQSp1hPzv4=; b=sGlTZSeN3w2tkgXdB22yMFYIQc7+NQjR8hCczRcflxYdDhKFZv3OxXh9y9xSoaDduH mId/0KzIAFkLAuSlL6jpHIXtRnUwAv64nV/TDwH9lTSt+Mj4GcvG/Z2nJV3xpNQSA7ya ZZnyDIcnOLQUIi8PzFx+878B+4+uV6s3fAr2xMPU47Oi5ITK/Ki5U2Mk8EOXpAco+fsE YvyBGXrcS2G14LrfdGJPUPG2eWUs3z1Ydm+yVUW3hHxyprjPjAmc/Wg7svdb9ar7BdzB xNn1bLBCnKBlqrapS9s3c75CBfvBgJ0We/I0FwPCXo1spwInuwopvzfyeL4etzf6zB9A UjJw== X-Gm-Message-State: ACgBeo3P4MAFMHhhlVD/flPR+H4e932keFKVMxel3ZJqBLb1jOJrrGfO uSoE0uCUoP18Ybcxt0woMDQqgyNUUl5lFg== X-Google-Smtp-Source: AA6agR4POqtkC3ST43plTkVt4+R4aPzKVY1oXZ4cfMEmFyWL6bjzQ7XVOL+mA7KKdO3yVAqqvZR1oQ== X-Received: by 2002:a63:ea11:0:b0:41d:9296:21e6 with SMTP id c17-20020a63ea11000000b0041d929621e6mr21540672pgi.603.1661296675079; Tue, 23 Aug 2022 16:17:55 -0700 (PDT) Received: from localhost ([50.221.140.186]) by smtp.gmail.com with ESMTPSA id o22-20020a17090ad25600b001f260b1954bsm10488461pjw.13.2022.08.23.16.17.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Aug 2022 16:17:53 -0700 (PDT) Subject: [PATCH] libgloss: riscv: Convert to non-recursive automake Date: Tue, 23 Aug 2022 16:12:56 -0700 Message-Id: <20220823231256.7028-1-palmer@rivosinc.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Cc: Palmer Dabbelt From: Palmer Dabbelt To: newlib@sourceware.org X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,GIT_PATCH_0,KAM_ASCII_DIVIDERS,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: PR 29515 points out our documentation builds are broken, let's just move over to the new non-recursive builds. Signed-off-by: Palmer Dabbelt --- I think something as small as adding an empty "html" target could make that bug report go away, but when poking around I couldn't figure out why our Makefile.in was so different. I ended up running into vapier's build system conversion patches and figured it would be easier to just throw away our current build configuration rather than trying to figure out how it works. This builds for me and the resulting libraries look generally OK, but I don't personally use newlib right now so I don't have anything specific setup for testing. I haven't included the generated files from running autoconf/automake as I'm getting a lot of diff right now due to some version mis-matches on my development box. If folks like this then I'm happy to sort that out, just figured I'd send something along now to see if this is the right way to go -- it's a lot of diff just to make "make html" work, but as far as I can tell the plan is to convert all subdirs over eventually so it seems sane to me. --- libgloss/Makefile.am | 3 + libgloss/configure.ac | 5 +- libgloss/riscv/Makefile.in | 330 ------------------------------------ libgloss/riscv/Makefile.inc | 71 ++++++++ 4 files changed, 76 insertions(+), 333 deletions(-) delete mode 100644 libgloss/riscv/Makefile.in create mode 100644 libgloss/riscv/Makefile.inc diff --git a/libgloss/Makefile.am b/libgloss/Makefile.am index 43da838f0..5464eb8bd 100644 --- a/libgloss/Makefile.am +++ b/libgloss/Makefile.am @@ -71,6 +71,9 @@ endif if CONFIG_LM32 include lm32/Makefile.inc endif +if CONFIG_RISCV +include riscv/Makefile.inc +endif if CONFIG_WINCE include wince/Makefile.inc endif diff --git a/libgloss/configure.ac b/libgloss/configure.ac index 3d8d2b031..b683ef65d 100644 --- a/libgloss/configure.ac +++ b/libgloss/configure.ac @@ -97,8 +97,7 @@ case "${target}" in target_makefile_frag=${srcdir}/config/mips.mt ;; riscv*-*-*) - AC_CONFIG_FILES([riscv/Makefile]) - subdirs="$subdirs riscv" + config_riscv=true ;; powerpc-*-*|powerpcle-*-*) AC_CONFIG_FILES([rs6000/Makefile]) @@ -239,7 +238,7 @@ esac dnl These subdirs have converted to non-recursive make. Hopefully someday all dnl the ports above will too! m4_foreach_w([SUBDIR], [ - bfin iq2000 libnosys lm32 wince + bfin iq2000 libnosys lm32 riscv wince ], [dnl AM_CONDITIONAL([CONFIG_]m4_toupper(SUBDIR), [test x$config_]SUBDIR = xtrue) ]) diff --git a/libgloss/riscv/Makefile.in b/libgloss/riscv/Makefile.in deleted file mode 100644 index 44891a096..000000000 --- a/libgloss/riscv/Makefile.in +++ /dev/null @@ -1,330 +0,0 @@ -#------------------------------------------------------------------------- -# Source files -#------------------------------------------------------------------------- - -gloss_hdrs = \ - machine/syscall.h \ - -gloss_srcs = \ - nanosleep.c \ - sys_access.c \ - sys_chdir.c \ - sys_chmod.c \ - sys_chown.c \ - sys_close.c \ - sys_conv_stat.c \ - sys_execve.c \ - sys_exit.c \ - sys_faccessat.c \ - sys_fork.c \ - sys_fstatat.c \ - sys_fstat.c \ - sys_ftime.c \ - sys_getcwd.c \ - sys_getpid.c \ - sys_gettimeofday.c \ - sys_isatty.c \ - sys_kill.c \ - sys_link.c \ - sys_lseek.c \ - sys_lstat.c \ - sys_openat.c \ - sys_open.c \ - sys_read.c \ - sys_sbrk.c \ - sys_stat.c \ - sys_sysconf.c \ - sys_times.c \ - sys_unlink.c \ - sys_utime.c \ - sys_wait.c \ - sys_write.c - -# libsemihost reuses some of the libgloss minimal implementations - -semihost_srcs = \ - nanosleep.c \ - sys_chdir.c \ - sys_chmod.c \ - sys_chown.c \ - sys_execve.c \ - sys_fork.c \ - sys_getcwd.c \ - sys_getpid.c \ - sys_kill.c \ - sys_utime.c \ - sys_wait.c \ - semihost-sys_close.c \ - semihost-sys_exit.c \ - semihost-sys_fdtable.c \ - semihost-sys_fstat.c \ - semihost-sys_ftime.c \ - semihost-sys_isatty.c \ - semihost-sys_link.c \ - semihost-sys_lseek.c \ - semihost-sys_open.c \ - semihost-sys_read.c \ - semihost-sys_sbrk.c \ - semihost-sys_stat.c \ - semihost-sys_stat_common.c \ - semihost-sys_unlink.c \ - semihost-sys_write.c - -gloss_specs = \ - nano.specs sim.specs semihost.specs - -# Extra files - -crt0_asm = crt0.S - -# Multilib support variables. -# TOP is used instead of MULTI{BUILD,SRC}TOP. - -MULTIDIRS = -MULTISUBDIR = -MULTIDO = true -MULTICLEAN = true - -#------------------------------------------------------------------------- -# Basic setup -#------------------------------------------------------------------------- - -# Remove all default implicit rules since they can cause subtle bugs -# and they just make things run slower - -.SUFFIXES: -% : %,v -% : RCS/%,v -% : RCS/% -% : s.% -% : SCCS/s.% - -# Default is to build the prereqs of the all target (defined at bottom) - -default : all -.PHONY : default - -# Source directory - -obj_dir := . -src_dir := @srcdir@ -VPATH := $(src_dir) $(src_dir)/machine - -# Installation directories - -prefix := @prefix@ -DESTDIR ?= $(prefix) - -install_hdrs_dir := $(DESTDIR)$(prefix)/$(target_alias)/include/machine -install_libs_dir = $(DESTDIR)$(prefix)/$(target_alias)/lib${MULTISUBDIR} - -#------------------------------------------------------------------------- -# Programs and flags -#------------------------------------------------------------------------- - -# C compiler - -CC := @CC@ -CFLAGS := @CFLAGS@ -CPPFLAGS := -I$(obj_dir) -I$(src_dir) -COMPILE := $(CC) -MMD -MP $(CPPFLAGS) $(CFLAGS) - -# Library creation - -AR := @AR@ -RANLIB := @RANLIB@ - -# Installation - -INSTALL := @INSTALL@ -INSTALL_DATA := @INSTALL_DATA@ - -#------------------------------------------------------------------------- -# Build Object Files from C Source -#------------------------------------------------------------------------- - -gloss_c_srcs = $(filter %.c, $(gloss_srcs)) -gloss_c_objs = $(patsubst %.c, %.o, $(notdir $(gloss_c_srcs))) -gloss_c_deps = $(patsubst %.c, %.d, $(notdir $(gloss_c_srcs))) - -$(gloss_c_objs) : %.o : %.c - $(COMPILE) -c $< - -gloss_objs += $(gloss_c_objs) -deps += $(gloss_c_deps) -junk += $(gloss_c_deps) $(gloss_c_objs) - -sim_c_objs = $(patsubst %.c, sim-%.o, $(notdir $(gloss_c_srcs))) -sim_c_deps = $(patsubst %.c, sim-%.d, $(notdir $(gloss_c_srcs))) - -$(sim_c_objs): sim-%.o : %.c - $(COMPILE) -c -DUSING_SIM_SPECS -o $@ $< - -sim_objs += $(sim_c_objs) -deps += $(sim_c_deps) -junk += $(sim_c_deps) $(sim_c_objs) - -semihost_c_srcs = $(filter %.c, $(semihost_srcs)) -semihost_c_objs = $(patsubst %.c, semihost-%.o, $(notdir $(semihost_c_srcs))) -semihost_c_deps = $(patsubst %.c, semihost-%.d, $(notdir $(semihost_c_srcs))) - -$(semihost_c_objs): semihost-%.o : %.c - $(COMPILE) -c -o $@ $< - -semihost_objs += $(semihost_c_objs) -deps += $(semihost_c_deps) -junk += $(semihost_c_deps) $(semihost_c_objs) - -#------------------------------------------------------------------------- -# Build Object Files from Assembly Source -#------------------------------------------------------------------------- - -gloss_asm_srcs = $(filter %.S, $(gloss_srcs)) -gloss_asm_objs = $(patsubst %.S, %.o, $(notdir $(gloss_asm_srcs))) -gloss_asm_deps = $(patsubst %.S, %.d, $(notdir $(gloss_asm_srcs))) - -$(gloss_asm_objs) : %.o : %.S - $(COMPILE) -c -o $@ $< - -gloss_objs += $(gloss_asm_objs) -deps += $(gloss_asm_deps) -junk += $(gloss_asm_deps) $(gloss_asm_objs) - -sim_asm_objs = $(patsubst %.S, sim-%.o, $(notdir $(gloss_asm_srcs))) -sim_asm_deps = $(patsubst %.S, sim-%.d, $(notdir $(gloss_asm_srcs))) - -$(sim_asm_objs) : sim-%.o : %.S - $(COMPILE) -c -DUSING_SIM_SPECS -o $@ $< - -sim_objs += $(sim_asm_objs) -deps += $(sim_asm_deps) -junk += $(sim_asm_deps) $(sim_asm_objs) - -semihost_asm_objs = $(patsubst %.S, semihost-%.o, $(notdir $(gloss_asm_srcs))) -semihost_asm_deps = $(patsubst %.S, semihost-%.d, $(notdir $(gloss_asm_srcs))) - -$(semihost_asm_objs) : semihost-%.o : %.S - $(COMPILE) -c -DUSING_SEMIHOST_SPECS -o $@ $< - -semihost_objs += $(semihost_asm_objs) -deps += $(semihost_asm_deps) -junk += $(semihost_asm_deps) $(semihost_asm_objs) - -#------------------------------------------------------------------------- -# Build libgloss.a -#------------------------------------------------------------------------- - -gloss_lib = libgloss.a -$(gloss_lib) : $(gloss_objs) - $(AR) rcv $@ $^ - $(RANLIB) $@ - -junk += $(gloss_lib) - -install_hdrs += $(gloss_hdrs) -install_libs += $(gloss_lib) -install_specs += $(gloss_specs) - -#------------------------------------------------------------------------- -# Build libsim.a -#------------------------------------------------------------------------- - -sim_lib = libsim.a -$(sim_lib) : $(sim_objs) - $(AR) rcv $@ $^ - $(RANLIB) $@ - -junk += $(sim_lib) - -install_libs += $(sim_lib) - -#------------------------------------------------------------------------- -# Build libsemihost.a -#------------------------------------------------------------------------- - -semihost_lib = libsemihost.a -$(semihost_lib) : $(semihost_objs) - $(AR) rcv $@ $^ - $(RANLIB) $@ - -junk += $(semihost_lib) - -install_libs += $(semihost_lib) - -#------------------------------------------------------------------------- -# Build crt0.o -#------------------------------------------------------------------------- - -crt0_obj = $(patsubst %.S, %.o, $(crt0_asm)) -crt0_deps = $(patsubst %.S, %.d, $(crt0_asm)) - -$(crt0_obj) : %.o : %.S - $(COMPILE) -c $< - -deps += $(crt0_deps) -junk += $(crt0_deps) $(crt0_obj) - -install_libs += $(crt0_obj) - -#------------------------------------------------------------------------- -# Autodependency files -#------------------------------------------------------------------------- - --include $(deps) - -deps : $(deps) -.PHONY : deps - -#------------------------------------------------------------------------- -# Installation -#------------------------------------------------------------------------- - -install_hdrs_wdir += $(addprefix $(src_dir)/, $(install_hdrs)) -install-hdrs : $(install_hdrs_wdir) - test -d $(install_hdrs_dir) || mkdir -p $(install_hdrs_dir) - for file in $^; do \ - $(INSTALL_DATA) $$file $(install_hdrs_dir)/; \ - done - -install-libs : $(install_libs) - test -d $(install_libs_dir) || mkdir -p $(install_libs_dir) - for file in $^; do \ - $(INSTALL_DATA) $$file $(install_libs_dir)/$$file; \ - done - -install-specs : $(install_specs) - test -d $(install_libs_dir) || mkdir -p $(install_libs_dir) - for file in $^; do \ - $(INSTALL_DATA) $$file $(install_libs_dir)/; \ - done - -install : install-hdrs install-libs install-specs -.PHONY : install install-hdrs install-libs - -#------------------------------------------------------------------------- -# Regenerate configure information -#------------------------------------------------------------------------- - -Makefile : $(src_dir)/Makefile.in ../config.status - cd .. && $(SHELL) config.status - -dist_junk += Makefile - -#------------------------------------------------------------------------- -# Default -#------------------------------------------------------------------------- - -all : $(install_libs) -.PHONY : all - -#------------------------------------------------------------------------- -# Clean up junk -#------------------------------------------------------------------------- - -clean : - rm -rf *~ \#* $(junk) - -distclean : - rm -rf *~ \#* $(junk) $(dist_junk) - -.PHONY : clean distclean diff --git a/libgloss/riscv/Makefile.inc b/libgloss/riscv/Makefile.inc new file mode 100644 index 000000000..5341038b3 --- /dev/null +++ b/libgloss/riscv/Makefile.inc @@ -0,0 +1,71 @@ +multilibtool_DATA += \ + %D%/nano.specs \ + %D%/sim.specs \ + %D%/semihost.specs \ + %D%/crt0.o + +multilibtool_LIBRARIES += %D%/libgloss.a +%C%_libgloss_a_CPPFLAGS = -I$(srcdir)/%D% +%C%_libgloss_a_SOURCES = \ + %D%/sys_access.c \ + %D%/sys_chdir.c \ + %D%/sys_chmod.c \ + %D%/sys_chown.c \ + %D%/sys_close.c \ + %D%/sys_conv_stat.c \ + %D%/sys_execve.c \ + %D%/sys_exit.c \ + %D%/sys_faccessat.c \ + %D%/sys_fork.c \ + %D%/sys_fstat.c \ + %D%/sys_fstatat.c \ + %D%/sys_ftime.c \ + %D%/sys_getcwd.c \ + %D%/sys_getpid.c \ + %D%/sys_gettimeofday.c \ + %D%/sys_isatty.c \ + %D%/sys_kill.c \ + %D%/sys_link.c \ + %D%/sys_lseek.c \ + %D%/sys_lstat.c \ + %D%/sys_open.c \ + %D%/sys_openat.c \ + %D%/sys_read.c \ + %D%/sys_sbrk.c \ + %D%/sys_stat.c \ + %D%/sys_sysconf.c \ + %D%/sys_times.c \ + %D%/sys_unlink.c \ + %D%/sys_utime.c \ + %D%/sys_wait.c \ + %D%/sys_write.c + +multilibtool_LIBRARIES += %D%/libsemihost.a +%C%_libsemihost_a_CPPFLAGS = -I$(srcdir)/%D% +%C%_libsemihost_a_SOURCES = \ + %D%/nanosleep.c \ + %D%/sys_chdir.c \ + %D%/sys_chmod.c \ + %D%/sys_chown.c \ + %D%/sys_execve.c \ + %D%/sys_fork.c \ + %D%/sys_getcwd.c \ + %D%/sys_getpid.c \ + %D%/sys_kill.c \ + %D%/sys_utime.c \ + %D%/sys_wait.c \ + %D%/semihost-sys_close.c \ + %D%/semihost-sys_exit.c \ + %D%/semihost-sys_fdtable.c \ + %D%/semihost-sys_fstat.c \ + %D%/semihost-sys_ftime.c \ + %D%/semihost-sys_isatty.c \ + %D%/semihost-sys_link.c \ + %D%/semihost-sys_lseek.c \ + %D%/semihost-sys_open.c \ + %D%/semihost-sys_read.c \ + %D%/semihost-sys_sbrk.c \ + %D%/semihost-sys_stat.c \ + %D%/semihost-sys_stat_common.c \ + %D%/semihost-sys_unlink.c \ + %D%/semihost-sys_write.c -- 2.34.1