From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: passt.top; dkim=pass (2048-bit key; secure) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.a=rsa-sha256 header.s=202602 header.b=HLzMyayO; dkim-atps=neutral Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id D48B75A026E for ; Tue, 12 May 2026 07:53:02 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202602; t=1778565179; bh=iSx5n9VmPInUGcDt2aEi8uip/AdGNe5JsiXnW6QKy+s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HLzMyayOvKf/p4q/OEgdLmoFr+Im2t+f++9lHMYy2vhLRT0FYQYNndzX+cpyWBF1a /PsYSSMM4/lFzit6aJTI1Bxozt02nuEvyp9D9uN97tkBjcFo6hUOLicxlTx9D0F3R/ pexyjPjqnI7YyvHpWsRZ16syfc4Qs6rEbYy1GkQ8UlzZelo2flMSJD65D2SDrBUL+b M0IkbJtRqdH3P/1KCTAT0C7671A5g5YtoLxtTmvRtXz0Lp7Ip7wrMI8YlhDKCOh4bF yPdXDb+sW9bVfiL7kLKLGn9dWoRhpFg6jdSgvu9nejhI7v9X/Txlr0Cv+tlS2AotAW zyy3jyOAQcevQ== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4gF5NW11tWz4wTM; Tue, 12 May 2026 15:52:59 +1000 (AEST) From: David Gibson To: passt-dev@passt.top, Stefano Brivio Subject: [PATCH v3 03/12] Makefile: Use common binary compilation rule Date: Tue, 12 May 2026 15:52:47 +1000 Message-ID: <20260512055256.1800449-4-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260512055256.1800449-1-david@gibson.dropbear.id.au> References: <20260512055256.1800449-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: 2YSBPZEDEGFF4AGYTWXNNDVAXJ72ME4Z X-Message-ID-Hash: 2YSBPZEDEGFF4AGYTWXNNDVAXJ72ME4Z X-MailFrom: dgibson@gandalf.ozlabs.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: David Gibson X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Each of our binaries (passt, passt.avx2, qrap and passt-repair) has a separate Make rule instructing how to compile it, but they're all basically identical. Combine these all into a single pattern rule, just using different dependencies and variable overrides where necessary. Signed-off-by: David Gibson --- Makefile | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index d489a862..88c8a15a 100644 --- a/Makefile +++ b/Makefile @@ -76,9 +76,14 @@ docdir ?= $(datarootdir)/doc/passt mandir ?= $(datarootdir)/man man1dir ?= $(mandir)/man1 -BIN := passt pasta qrap passt-repair pesto +BASEBIN := passt qrap passt-repair pesto ifeq ($(TARGET_ARCH),x86_64) -BIN += passt.avx2 pasta.avx2 +BASEBIN += passt.avx2 +endif + +BIN = $(BASEBIN) pasta +ifeq ($(TARGET_ARCH),x86_64) +BIN += pasta.avx2 endif all: $(BIN) $(MANPAGES) docs @@ -95,27 +100,24 @@ seccomp_repair.h: seccomp.sh $(PASST_REPAIR_SRCS) seccomp_pesto.h: seccomp.sh $(PESTO_SRCS) @ ARCH="$(TARGET_ARCH)" CC="$(CC)" ./seccomp.sh seccomp_pesto.h $(PESTO_SRCS) +$(BASEBIN): %: + $(CC) $(FLAGS) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(filter %.c,$^) -o $@ + passt: $(PASST_SRCS) $(HEADERS) - $(CC) $(FLAGS) $(CFLAGS) $(CPPFLAGS) $(PASST_SRCS) -o passt $(LDFLAGS) passt.avx2: FLAGS += -Ofast -mavx2 -ftree-vectorize -funroll-loops passt.avx2: $(PASST_SRCS) $(HEADERS) - $(CC) $(filter-out -O2,$(FLAGS)) $(CFLAGS) $(CPPFLAGS) \ - $(PASST_SRCS) -o passt.avx2 $(LDFLAGS) - -passt.avx2: passt pasta.avx2 pasta.1 pasta: pasta%: passt% ln -sf $< $@ +qrap: FLAGS += -DARCH=\"$(TARGET_ARCH)\" qrap: $(QRAP_SRCS) passt.h - $(CC) $(FLAGS) $(CFLAGS) $(CPPFLAGS) -DARCH=\"$(TARGET_ARCH)\" $(QRAP_SRCS) -o qrap $(LDFLAGS) passt-repair: $(PASST_REPAIR_SRCS) seccomp_repair.h - $(CC) $(FLAGS) $(CFLAGS) $(CPPFLAGS) $(PASST_REPAIR_SRCS) -o passt-repair $(LDFLAGS) +pesto: FLAGS += -DPESTO pesto: $(PESTO_SRCS) $(PESTO_HEADERS) seccomp_pesto.h - $(CC) $(FLAGS) $(CFLAGS) $(CPPFLAGS) -DPESTO $(PESTO_SRCS) -o pesto $(LDFLAGS) valgrind: EXTRA_SYSCALLS += rt_sigprocmask rt_sigtimedwait rt_sigaction \ rt_sigreturn getpid gettid kill clock_gettime \ -- 2.54.0