From 7cc7f47424980d55f63167c96fcb5e083af93857 Mon Sep 17 00:00:00 2001 From: John Johansen Date: Wed, 6 Nov 2024 08:46:08 -0700 Subject: [PATCH] parser: fix and cleanup libapparmor_re/Makefile The Makefile is missing some of its .h depenedncies causing compiles to either fail or worse result in bad builds when rebuilding in an already built tree. Move the header dependencies into a variable and use it for each target. While some targets don't need every include as a dependency and this will result in unnecessary rebuilds in some cases, it makes the Makefile cleaner, easier to maintain and makes sure a dependency isn't accidentally missed. Signed-off-by: John Johansen --- parser/libapparmor_re/Makefile | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/parser/libapparmor_re/Makefile b/parser/libapparmor_re/Makefile index 620dd297e..43d0cee5c 100644 --- a/parser/libapparmor_re/Makefile +++ b/parser/libapparmor_re/Makefile @@ -14,6 +14,14 @@ AR ?= ar CFLAGS ?= -g -Wall -O2 ${EXTRA_CFLAGS} -std=gnu++0x CXXFLAGS := ${CFLAGS} ${INCLUDE_APPARMOR} +LIB_HDRS = aare_rules.h flex-tables.h apparmor_re.h hfa.h chfa.h parse.h \ + expr-tree.h policy_compat.h + +OTHER_HDRS = ../common_optarg.h ../common_flags.h ../immunix.h \ + ../policydb.h ../perms.h ../rule.h + +HDRS = ${LIB_HDRS} ${OTHER_HDRS} + ARFLAGS=-rcs BISON := bison @@ -27,17 +35,17 @@ libapparmor_re.a: parse.o expr-tree.o hfa.o chfa.o aare_rules.o policy_compat.o expr-tree.o: expr-tree.cc expr-tree.h -hfa.o: hfa.cc apparmor_re.h hfa.h ../immunix.h policy_compat.h +hfa.o: hfa.cc ${HDRS} -aare_rules.o: aare_rules.cc aare_rules.h apparmor_re.h expr-tree.h hfa.h chfa.h parse.h ../immunix.h +aare_rules.o: aare_rules.cc ${HDRS} -chfa.o: chfa.cc chfa.h ../immunix.h +chfa.o: chfa.cc ${HDRS} -policy_compat.o: policy_compat.cc policy_compat.h ../perms.h ../immunix.h +policy_compat.o: policy_compat.cc ${HDRS} -parse.o : parse.cc apparmor_re.h expr-tree.h +parse.o : parse.cc ${HDRS} -parse.cc : parse.y parse.h flex-tables.h ../immunix.h +parse.cc : parse.y ${HDRS} ${BISON} -o $@ $< clean: