From: Johannes Berg <johannes.berg@xxxxxxxxx> Derive the library name from the directory name, and let each library Makefile only declare the objects that are needed. This reduces duplicate code for the ar call. While at it, also pretty-print that call. Signed-off-by: Johannes Berg <johannes.berg@xxxxxxxxx> --- src/ap/Makefile | 4 ---- src/common/Makefile | 4 ---- src/crypto/Makefile | 4 ---- src/eap_common/Makefile | 4 ---- src/eap_peer/Makefile | 4 ---- src/eap_server/Makefile | 4 ---- src/eapol_auth/Makefile | 4 ---- src/eapol_supp/Makefile | 4 ---- src/l2_packet/Makefile | 4 ---- src/lib.rules | 8 ++++++++ src/p2p/Makefile | 4 ---- src/radius/Makefile | 4 ---- src/rsn_supp/Makefile | 4 ---- src/tls/Makefile | 4 ---- src/utils/Makefile | 4 ---- src/wps/Makefile | 4 ---- 16 files changed, 8 insertions(+), 60 deletions(-) diff --git a/src/ap/Makefile b/src/ap/Makefile index 09d54924cb7e..9d67fb58b4e1 100644 --- a/src/ap/Makefile +++ b/src/ap/Makefile @@ -1,5 +1,3 @@ -ALL=$(OUT)libap.a - include ../lib.rules install: @@ -67,5 +65,3 @@ LIB_OBJS= \ _OBJS_VAR := LIB_OBJS include ../objs.mk -$(OUT)libap.a: $(LIB_OBJS) - $(AR) crT $@ $? diff --git a/src/common/Makefile b/src/common/Makefile index 19573ebd30e0..a731c9230c0a 100644 --- a/src/common/Makefile +++ b/src/common/Makefile @@ -1,5 +1,3 @@ -ALL=$(OUT)libcommon.a - include ../lib.rules install: @@ -21,5 +19,3 @@ LIB_OBJS= \ _OBJS_VAR := LIB_OBJS include ../objs.mk -$(OUT)libcommon.a: $(LIB_OBJS) - $(AR) crT $@ $? diff --git a/src/crypto/Makefile b/src/crypto/Makefile index b8accd81c583..b0e13bd1d279 100644 --- a/src/crypto/Makefile +++ b/src/crypto/Makefile @@ -1,5 +1,3 @@ -ALL=$(OUT)libcrypto.a - include ../lib.rules install: @@ -68,5 +66,3 @@ endif _OBJS_VAR := LIB_OBJS include ../objs.mk -$(OUT)libcrypto.a: $(LIB_OBJS) - $(AR) crT $@ $? diff --git a/src/eap_common/Makefile b/src/eap_common/Makefile index b50a4b731412..c85d01de727b 100644 --- a/src/eap_common/Makefile +++ b/src/eap_common/Makefile @@ -1,5 +1,3 @@ -ALL=$(OUT)libeap_common.a - include ../lib.rules install: @@ -25,5 +23,3 @@ LIB_OBJS= \ _OBJS_VAR := LIB_OBJS include ../objs.mk -$(OUT)libeap_common.a: $(LIB_OBJS) - $(AR) crT $@ $? diff --git a/src/eap_peer/Makefile b/src/eap_peer/Makefile index d7a0372ad761..1ce905d8c839 100644 --- a/src/eap_peer/Makefile +++ b/src/eap_peer/Makefile @@ -1,5 +1,3 @@ -ALL=$(OUT)libeap_peer.a - include ../lib.rules install: @@ -17,5 +15,3 @@ LIB_OBJS= \ _OBJS_VAR := LIB_OBJS include ../objs.mk -$(OUT)libeap_peer.a: $(LIB_OBJS) - $(AR) crT $@ $? diff --git a/src/eap_server/Makefile b/src/eap_server/Makefile index b4261ec39263..c68565c07f9e 100644 --- a/src/eap_server/Makefile +++ b/src/eap_server/Makefile @@ -1,5 +1,3 @@ -ALL=$(OUT)libeap_server.a - include ../lib.rules install: @@ -15,5 +13,3 @@ LIB_OBJS= \ _OBJS_VAR := LIB_OBJS include ../objs.mk -$(OUT)libeap_server.a: $(LIB_OBJS) - $(AR) crT $@ $? diff --git a/src/eapol_auth/Makefile b/src/eapol_auth/Makefile index aa597eda4499..328e18f508e2 100644 --- a/src/eapol_auth/Makefile +++ b/src/eapol_auth/Makefile @@ -1,5 +1,3 @@ -ALL=$(OUT)libeapol_auth.a - include ../lib.rules install: @@ -10,5 +8,3 @@ LIB_OBJS = eapol_auth_sm.o eapol_auth_dump.o _OBJS_VAR := LIB_OBJS include ../objs.mk -$(OUT)libeapol_auth.a: $(LIB_OBJS) - $(AR) crT $@ $? diff --git a/src/eapol_supp/Makefile b/src/eapol_supp/Makefile index 453e49e6bf4b..108e66c4c7aa 100644 --- a/src/eapol_supp/Makefile +++ b/src/eapol_supp/Makefile @@ -1,5 +1,3 @@ -ALL=$(OUT)libeapol_supp.a - include ../lib.rules install: @@ -12,5 +10,3 @@ LIB_OBJS = eapol_supp_sm.o _OBJS_VAR := LIB_OBJS include ../objs.mk -$(OUT)libeapol_supp.a: $(LIB_OBJS) - $(AR) crT $@ $? diff --git a/src/l2_packet/Makefile b/src/l2_packet/Makefile index 870d652bc63e..5c69413f3168 100644 --- a/src/l2_packet/Makefile +++ b/src/l2_packet/Makefile @@ -1,5 +1,3 @@ -ALL=$(OUT)libl2_packet.a - include ../lib.rules install: @@ -10,5 +8,3 @@ LIB_OBJS = l2_packet_linux.o _OBJS_VAR := LIB_OBJS include ../objs.mk -$(OUT)libl2_packet.a: $(LIB_OBJS) - $(AR) crT $@ $? diff --git a/src/lib.rules b/src/lib.rules index 81b895967e01..99b7bd026958 100644 --- a/src/lib.rules +++ b/src/lib.rules @@ -1,3 +1,6 @@ +_LIBMK := $(lastword $(wordlist 1,$(shell expr $(words $(MAKEFILE_LIST)) - 1),$(MAKEFILE_LIST))) +_LIBNAME := $(notdir $(patsubst %/,%,$(dir $(abspath $(_LIBMK))))) +ALL := $(OUT)lib$(_LIBNAME).a LIB_RULES := $(lastword $(MAKEFILE_LIST)) include $(dir $(LIB_RULES))build.rules @@ -9,5 +12,10 @@ endif CFLAGS += $(FUZZ_CFLAGS) CFLAGS += -I.. -I../utils +.SECONDEXPANSION: +$(ALL): $$(LIB_OBJS) + @$(E) " AR $(notdir $@)" + $(Q)$(AR) crT $@ $? + clean: $(Q)rm -f *~ *.o *.d *.gcno *.gcda *.gcov $(ALL) diff --git a/src/p2p/Makefile b/src/p2p/Makefile index 00e1908f0bc1..0289dec5e3b9 100644 --- a/src/p2p/Makefile +++ b/src/p2p/Makefile @@ -1,5 +1,3 @@ -ALL=$(OUT)libp2p.a - include ../lib.rules install: @@ -23,5 +21,3 @@ LIB_OBJS= \ _OBJS_VAR := LIB_OBJS include ../objs.mk -$(OUT)libp2p.a: $(LIB_OBJS) - $(AR) crT $@ $? diff --git a/src/radius/Makefile b/src/radius/Makefile index 5cefa390fab9..8d25400e9c59 100644 --- a/src/radius/Makefile +++ b/src/radius/Makefile @@ -1,5 +1,3 @@ -ALL=$(OUT)libradius.a - include ../lib.rules install: @@ -16,5 +14,3 @@ LIB_OBJS= \ _OBJS_VAR := LIB_OBJS include ../objs.mk -$(OUT)libradius.a: $(LIB_OBJS) - $(AR) crT $@ $? diff --git a/src/rsn_supp/Makefile b/src/rsn_supp/Makefile index f5f5cad17dfb..25accf795767 100644 --- a/src/rsn_supp/Makefile +++ b/src/rsn_supp/Makefile @@ -1,5 +1,3 @@ -ALL=$(OUT)librsn_supp.a - include ../lib.rules install: @@ -21,5 +19,3 @@ LIB_OBJS= \ _OBJS_VAR := LIB_OBJS include ../objs.mk -$(OUT)librsn_supp.a: $(LIB_OBJS) - $(AR) crT $@ $? diff --git a/src/tls/Makefile b/src/tls/Makefile index 5483345e5331..0e79902ef364 100644 --- a/src/tls/Makefile +++ b/src/tls/Makefile @@ -1,5 +1,3 @@ -ALL=$(OUT)libtls.a - include ../lib.rules install: @@ -33,5 +31,3 @@ LIB_OBJS= \ _OBJS_VAR := LIB_OBJS include ../objs.mk -$(OUT)libtls.a: $(LIB_OBJS) - $(AR) crT $@ $? diff --git a/src/utils/Makefile b/src/utils/Makefile index 91aba38466ff..fc7f4323d219 100644 --- a/src/utils/Makefile +++ b/src/utils/Makefile @@ -1,5 +1,3 @@ -ALL=$(OUT)libutils.a - include ../lib.rules install: @@ -36,5 +34,3 @@ LIB_OBJS += edit.o _OBJS_VAR := LIB_OBJS include ../objs.mk -$(OUT)libutils.a: $(LIB_OBJS) - $(AR) crT $@ $? diff --git a/src/wps/Makefile b/src/wps/Makefile index 79106952783d..d7660fdd4f4b 100644 --- a/src/wps/Makefile +++ b/src/wps/Makefile @@ -1,5 +1,3 @@ -ALL=$(OUT)libwps.a - include ../lib.rules install: @@ -35,5 +33,3 @@ LIB_OBJS= \ _OBJS_VAR := LIB_OBJS include ../objs.mk -$(OUT)libwps.a: $(LIB_OBJS) - $(AR) crT $@ $? -- 2.26.2 _______________________________________________ Hostap mailing list Hostap@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/hostap