aboutgitcodebugslistschat
path: root/Makefile
diff options
context:
space:
mode:
authorKuhnChris <kuhnchris@kuhnchris.eu>2023-06-28 16:07:28 +0200
committerStefano Brivio <sbrivio@redhat.com>2023-07-07 22:34:37 +0200
commitcc2a6bec3cf2ff6ed0c043ada93d352466614373 (patch)
tree65c488a9dec778dd218fd88c38362603cac09908 /Makefile
parente01759e2fab0f66fa5876794425d3ec8489562a9 (diff)
downloadpasst-cc2a6bec3cf2ff6ed0c043ada93d352466614373.tar
passt-cc2a6bec3cf2ff6ed0c043ada93d352466614373.tar.gz
passt-cc2a6bec3cf2ff6ed0c043ada93d352466614373.tar.bz2
passt-cc2a6bec3cf2ff6ed0c043ada93d352466614373.tar.lz
passt-cc2a6bec3cf2ff6ed0c043ada93d352466614373.tar.xz
passt-cc2a6bec3cf2ff6ed0c043ada93d352466614373.tar.zst
passt-cc2a6bec3cf2ff6ed0c043ada93d352466614373.zip
MAKE: Fix parallel builds; .o files; .gitignore; new makedocs
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile51
1 files changed, 25 insertions, 26 deletions
diff --git a/Makefile b/Makefile
index a5256f5..4c99771 100644
--- a/Makefile
+++ b/Makefile
@@ -100,29 +100,41 @@ else
BIN := passt pasta qrap
endif
-all: $(BIN) $(MANPAGES) docs
+.NOTPARALLEL: seccomp.h
+all: seccomp.h $(BIN) $(MANPAGES) docs
+
+PASST_OBJS = $(PASST_SRCS:.c=.o)
+PASST_AVX2_OBJS = $(PASST_SRCS:.c=.avx2.o)
+OBJS = $(SRCS:.c=.o)
+QRAP_OBJS = $(QRAP_SRCS:.c=.o)
+AVXFLAGS += -Ofast -mavx2 -ftree-vectorize -funroll-loops
static: FLAGS += -static -DGLIBC_NO_STATIC_NSS
-static: clean all
+static: clean seccomp.h all
seccomp.h: seccomp.sh $(PASST_SRCS) $(PASST_HEADERS)
@ EXTRA_SYSCALLS="$(EXTRA_SYSCALLS)" ARCH="$(TARGET_ARCH)" CC="$(CC)" ./seccomp.sh $(PASST_SRCS) $(PASST_HEADERS)
-passt: $(PASST_SRCS) $(HEADERS)
- $(CC) $(FLAGS) $(CFLAGS) $(CPPFLAGS) $(PASST_SRCS) -o passt $(LDFLAGS)
+.c.o:
+ $(CC) $(FLAGS) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
+
+$(PASST_AVX2_OBJS): seccomp.h
+ $(CC) $(AVXFLAGS) $(FLAGS) $(CFLAGS) $(CPPFLAGS) -c $(@:.avx2.o=.c) -o $@
+
+passt: $(PASST_OBJS) seccomp.h
+ $(CC) $(FLAGS) $(CFLAGS) $(CPPFLAGS) $(PASST_OBJS) -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_AVX2_OBJS) $(HEADERS) seccomp.h
+ $(CC) $(filter-out -O2,$(FLAGS)) $(CFLAGS) $(CPPFLAGS) $(AVXFLAGS) \
+ $(PASST_AVX2_OBJS) -o passt.avx2 $(LDFLAGS)
-passt.avx2: passt
+passt.avx2: passt seccomp.h
pasta.avx2 pasta.1 pasta: pasta%: passt%
ln -sf $< $@
-qrap: $(QRAP_SRCS) passt.h
- $(CC) $(FLAGS) $(CFLAGS) $(CPPFLAGS) $(QRAP_SRCS) -o qrap $(LDFLAGS)
+qrap: $(QRAP_OBJS) passt.h seccomp.h
+ $(CC) $(FLAGS) $(CFLAGS) $(CPPFLAGS) $(QRAP_OBJS) -o qrap $(LDFLAGS)
valgrind: EXTRA_SYSCALLS += rt_sigprocmask rt_sigtimedwait rt_sigaction \
getpid gettid kill clock_gettime mmap \
@@ -170,21 +182,8 @@ pkgs: static
# other way around: the web version should be obtained by adding HTML and
# JavaScript portions to a plain Markdown, instead. However, cgit needs to use
# a file in the git tree. Find a better way around this.
-docs: README.md
- @( \
- skip=0; \
- while read l; do \
- case $$l in \
- "## Demo") exit 0 ;; \
- "<!"*) ;; \
- "</"*) skip=1 ;; \
- "<"*) skip=2 ;; \
- esac; \
- \
- [ $$skip -eq 0 ] && echo "$$l"; \
- [ $$skip -eq 1 ] && skip=0; \
- done < README.md; \
- ) > README.plain.md
+docs:
+ [ ! -e doc/ ]; mkdir docs; perl makedocs.pl > docs/README.plain.md
# Checkers currently disabled for clang-tidy:
# - llvmlibc-restrict-system-libc-headers