From nobody Thu Apr 25 17:36:19 2024 X-Original-To: freebsd-questions@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VQNM84fwhz5JBpd for ; Thu, 25 Apr 2024 17:36:36 +0000 (UTC) (envelope-from tomek@cedro.info) Received: from mail-yw1-x112f.google.com (mail-yw1-x112f.google.com [IPv6:2607:f8b0:4864:20::112f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VQNM757MFz4Q22 for ; Thu, 25 Apr 2024 17:36:35 +0000 (UTC) (envelope-from tomek@cedro.info) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=cedro.info header.s=google header.b=ban4cR2n; dmarc=none; spf=none (mx1.freebsd.org: domain of tomek@cedro.info has no SPF policy when checking 2607:f8b0:4864:20::112f) smtp.mailfrom=tomek@cedro.info Received: by mail-yw1-x112f.google.com with SMTP id 00721157ae682-61b92a83216so15006687b3.2 for ; Thu, 25 Apr 2024 10:36:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cedro.info; s=google; t=1714066593; x=1714671393; darn=freebsd.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=hF1G72K7IH4lMpi/opGSX6I0LaB8yzpBOO1T92UEKF0=; b=ban4cR2nhmrL5aefySlUom9Gl9HQIfS9lHtgPojdn9r62W0uaZ836nrPavKi+TlzmS nbPUl5h3oZzg+yqoZtcBulZQdmU+X9RY0t53cMX3N1E1H9AkX5ABVmeQqlffRy0YZ9AW JJx21MzcBomO4ql/fJuYOIRv5cWd0ZR4gW5f5FnWLosEtTEvaYf/9JeVoTPs2EaCOAw5 qkZg0UVaFnc6H1TdhXLcgxRQ1WxwsXmeIireJIEoyEGoPp70wVT6WQ13xEmLSH9UEtG+ CQElyGwOz2+lYy+vuMnUXab7HWaJM1dteJWafgzqg51juSTtY5hGHQK/M8T4i5GeIU3F 7WNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714066593; x=1714671393; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=hF1G72K7IH4lMpi/opGSX6I0LaB8yzpBOO1T92UEKF0=; b=jVQpIVFarefnaxwytDADHo2QiNa3pv8p1HmiZOdl7Y+fKiUEL3CS5RnILcXHqe0SXZ DYkXC+2FfqxSMp0JqHNK0aZSk7dywA8/Q68vguphuDt+n5O2ojtOyRxSTitz/+amzgLd vdd7r5+grf3Myk3qe8CNhqFDAipUC7V8v0B/ZbpbaviTiaaV2B3T2c0mHWsDecA65+hV IqraiOxis1xOEC7D+lpl82ZXZCoTxR7YNvCQCYKxzvytzAQUYTh/DCq/ZJnor2Qrn8w1 2evARB3uryXZuIdOV4k+3yFX/6SwwKlBWVRg37CEh7I6YgxjXz3P/G1JYJ0711VVp4JN 0ILQ== X-Gm-Message-State: AOJu0YwytbIjYEsY6AgC90eWhX+E636jvXOX84xEAnfGy6FgOtNHphWP UtNiz4RtqxD6U1j9IHo4iy+D0WO+95J7TIqPe/Ee3k6lfhVRh7N3+Aj3AfU8E3S2ueLLMxna4tg = X-Google-Smtp-Source: AGHT+IGrG8iuWrnbD1ZMMFrk+N/fTtzCQBCaVvzdjux1mP+95ndryP7jifroOLpktUBnZOWrucELzg== X-Received: by 2002:a05:690c:6e0b:b0:618:8b8a:b4de with SMTP id jb11-20020a05690c6e0b00b006188b8ab4demr191358ywb.27.1714066593295; Thu, 25 Apr 2024 10:36:33 -0700 (PDT) Received: from mail-yb1-f176.google.com (mail-yb1-f176.google.com. [209.85.219.176]) by smtp.gmail.com with ESMTPSA id x135-20020a0dd58d000000b006186a9d32b0sm3652139ywd.43.2024.04.25.10.36.32 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 25 Apr 2024 10:36:32 -0700 (PDT) Received: by mail-yb1-f176.google.com with SMTP id 3f1490d57ef6-de54b28c41eso1477492276.0 for ; Thu, 25 Apr 2024 10:36:32 -0700 (PDT) X-Received: by 2002:a25:ae46:0:b0:de5:5288:1e56 with SMTP id g6-20020a25ae46000000b00de552881e56mr349614ybe.8.1714066592160; Thu, 25 Apr 2024 10:36:32 -0700 (PDT) List-Id: User questions List-Archive: https://lists.freebsd.org/archives/freebsd-questions List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: freebsd-questions@freebsd.org Sender: owner-freebsd-questions@FreeBSD.org MIME-Version: 1.0 From: Tomek CEDRO Date: Thu, 25 Apr 2024 19:36:19 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: bsd sed / make vs bsd sed / make To: FreeBSD Questions Mailing List Content-Type: text/plain; charset="UTF-8" X-Spamd-Bar: --- X-Spamd-Result: default: False [-3.30 / 15.00]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-0.998]; R_DKIM_ALLOW(-0.20)[cedro.info:s=google]; MIME_GOOD(-0.10)[text/plain]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; R_SPF_NA(0.00)[no SPF record]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; MIME_TRACE(0.00)[0:+]; MISSING_XM_UA(0.00)[]; ARC_NA(0.00)[]; DMARC_NA(0.00)[cedro.info]; RCVD_TLS_LAST(0.00)[]; MLMMJ_DEST(0.00)[freebsd-questions@freebsd.org]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::112f:from,209.85.219.176:received]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_ALL(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[freebsd-questions@freebsd.org]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[cedro.info:+] X-Rspamd-Queue-Id: 4VQNM757MFz4Q22 Hello world :-) Are there any SED and MAKE experts around? :-) There is a piece of Makefile within NuttX RTOS simulator code that creates the linker scripts. I would like to fix the upstream so it builds out of the box on FreeBSD (*BSD). sed -e '/====/,/====/!d;//d' -e 's/__executable_start/_stext/g' \ -e 's/^\(\s\+\)\(\.init_array\)/\1\2 : { }\n\1.sinit/g' \ -e 's/^\(\s\+\)\(\.fini_array\)/\1\2 : { }\n\1.einit/g' \ -e 's/__init_array_start/_sinit/g' -e 's/__init_array_end/_einit/g' \ -e 's/__fini_array_start/_sfini/g' -e 's/__fini_array_end/_efini/g' >nuttx.ld It does not work with BSD sed but when I replace this with gsed all works fine. BSD sed complalins about trailinig backslash: sed: 1: "s/^\(\s\+\)\(\.init_arr ...": RE error: trailing backslash (\) Is there a way to fix that part so it works both with GNU sed and BSD sed? The easiest way would be adding ${SEDCMD} set to "gsed" on BSD and "sed" for the others (macOS also seems to use gnu sed). Another question is on Makefile. Project uses thousands of GNU syntax Makefiles. So I have to use gmake to build. Is there an elegant way to use BSD make here with no dramatic code modification? Any hints appreciated :-) Tomek -- CeDeROM, SQ7MHZ, http://www.tomek.cedro.info