aboutgitcodebugslistschat
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2026-05-12 15:52:47 +1000
committerStefano Brivio <sbrivio@redhat.com>2026-05-16 15:45:38 +0200
commitd4632a43573ff451f90fb702c824030b4bdfa734 (patch)
treef37d28a479fecbebc3de507e89a1cf1b03edec07
parent59b14b294a0b27edc4408cca1b2b81e9ded8d50d (diff)
downloadpasst-d4632a43573ff451f90fb702c824030b4bdfa734.tar
passt-d4632a43573ff451f90fb702c824030b4bdfa734.tar.gz
passt-d4632a43573ff451f90fb702c824030b4bdfa734.tar.bz2
passt-d4632a43573ff451f90fb702c824030b4bdfa734.tar.lz
passt-d4632a43573ff451f90fb702c824030b4bdfa734.tar.xz
passt-d4632a43573ff451f90fb702c824030b4bdfa734.tar.zst
passt-d4632a43573ff451f90fb702c824030b4bdfa734.zip
Makefile: Use common binary compilation rule
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 <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
-rw-r--r--Makefile22
1 files changed, 12 insertions, 10 deletions
diff --git a/Makefile b/Makefile
index d489a86..88c8a15 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 \