build: Make a common library build

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@intel.com>
This commit is contained in:
Johannes Berg 2020-10-12 12:14:04 +02:00 committed by Jouni Malinen
parent ac1447ae9d
commit f4b3d14e97
16 changed files with 8 additions and 60 deletions

View File

@ -1,5 +1,3 @@
ALL=$(OUT)libap.a
include ../lib.rules include ../lib.rules
install: install:
@ -67,5 +65,3 @@ LIB_OBJS= \
_OBJS_VAR := LIB_OBJS _OBJS_VAR := LIB_OBJS
include ../objs.mk include ../objs.mk
$(OUT)libap.a: $(LIB_OBJS)
$(AR) crT $@ $?

View File

@ -1,5 +1,3 @@
ALL=$(OUT)libcommon.a
include ../lib.rules include ../lib.rules
install: install:
@ -21,5 +19,3 @@ LIB_OBJS= \
_OBJS_VAR := LIB_OBJS _OBJS_VAR := LIB_OBJS
include ../objs.mk include ../objs.mk
$(OUT)libcommon.a: $(LIB_OBJS)
$(AR) crT $@ $?

View File

@ -1,5 +1,3 @@
ALL=$(OUT)libcrypto.a
include ../lib.rules include ../lib.rules
install: install:
@ -68,5 +66,3 @@ endif
_OBJS_VAR := LIB_OBJS _OBJS_VAR := LIB_OBJS
include ../objs.mk include ../objs.mk
$(OUT)libcrypto.a: $(LIB_OBJS)
$(AR) crT $@ $?

View File

@ -1,5 +1,3 @@
ALL=$(OUT)libeap_common.a
include ../lib.rules include ../lib.rules
install: install:
@ -25,5 +23,3 @@ LIB_OBJS= \
_OBJS_VAR := LIB_OBJS _OBJS_VAR := LIB_OBJS
include ../objs.mk include ../objs.mk
$(OUT)libeap_common.a: $(LIB_OBJS)
$(AR) crT $@ $?

View File

@ -1,5 +1,3 @@
ALL=$(OUT)libeap_peer.a
include ../lib.rules include ../lib.rules
install: install:
@ -17,5 +15,3 @@ LIB_OBJS= \
_OBJS_VAR := LIB_OBJS _OBJS_VAR := LIB_OBJS
include ../objs.mk include ../objs.mk
$(OUT)libeap_peer.a: $(LIB_OBJS)
$(AR) crT $@ $?

View File

@ -1,5 +1,3 @@
ALL=$(OUT)libeap_server.a
include ../lib.rules include ../lib.rules
install: install:
@ -15,5 +13,3 @@ LIB_OBJS= \
_OBJS_VAR := LIB_OBJS _OBJS_VAR := LIB_OBJS
include ../objs.mk include ../objs.mk
$(OUT)libeap_server.a: $(LIB_OBJS)
$(AR) crT $@ $?

View File

@ -1,5 +1,3 @@
ALL=$(OUT)libeapol_auth.a
include ../lib.rules include ../lib.rules
install: install:
@ -10,5 +8,3 @@ LIB_OBJS = eapol_auth_sm.o eapol_auth_dump.o
_OBJS_VAR := LIB_OBJS _OBJS_VAR := LIB_OBJS
include ../objs.mk include ../objs.mk
$(OUT)libeapol_auth.a: $(LIB_OBJS)
$(AR) crT $@ $?

View File

@ -1,5 +1,3 @@
ALL=$(OUT)libeapol_supp.a
include ../lib.rules include ../lib.rules
install: install:
@ -12,5 +10,3 @@ LIB_OBJS = eapol_supp_sm.o
_OBJS_VAR := LIB_OBJS _OBJS_VAR := LIB_OBJS
include ../objs.mk include ../objs.mk
$(OUT)libeapol_supp.a: $(LIB_OBJS)
$(AR) crT $@ $?

View File

@ -1,5 +1,3 @@
ALL=$(OUT)libl2_packet.a
include ../lib.rules include ../lib.rules
install: install:
@ -10,5 +8,3 @@ LIB_OBJS = l2_packet_linux.o
_OBJS_VAR := LIB_OBJS _OBJS_VAR := LIB_OBJS
include ../objs.mk include ../objs.mk
$(OUT)libl2_packet.a: $(LIB_OBJS)
$(AR) crT $@ $?

View File

@ -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)) LIB_RULES := $(lastword $(MAKEFILE_LIST))
include $(dir $(LIB_RULES))build.rules include $(dir $(LIB_RULES))build.rules
@ -9,5 +12,10 @@ endif
CFLAGS += $(FUZZ_CFLAGS) CFLAGS += $(FUZZ_CFLAGS)
CFLAGS += -I.. -I../utils CFLAGS += -I.. -I../utils
.SECONDEXPANSION:
$(ALL): $$(LIB_OBJS)
@$(E) " AR $(notdir $@)"
$(Q)$(AR) crT $@ $?
clean: clean:
$(Q)rm -f *~ *.o *.d *.gcno *.gcda *.gcov $(ALL) $(Q)rm -f *~ *.o *.d *.gcno *.gcda *.gcov $(ALL)

View File

@ -1,5 +1,3 @@
ALL=$(OUT)libp2p.a
include ../lib.rules include ../lib.rules
install: install:
@ -23,5 +21,3 @@ LIB_OBJS= \
_OBJS_VAR := LIB_OBJS _OBJS_VAR := LIB_OBJS
include ../objs.mk include ../objs.mk
$(OUT)libp2p.a: $(LIB_OBJS)
$(AR) crT $@ $?

View File

@ -1,5 +1,3 @@
ALL=$(OUT)libradius.a
include ../lib.rules include ../lib.rules
install: install:
@ -16,5 +14,3 @@ LIB_OBJS= \
_OBJS_VAR := LIB_OBJS _OBJS_VAR := LIB_OBJS
include ../objs.mk include ../objs.mk
$(OUT)libradius.a: $(LIB_OBJS)
$(AR) crT $@ $?

View File

@ -1,5 +1,3 @@
ALL=$(OUT)librsn_supp.a
include ../lib.rules include ../lib.rules
install: install:
@ -21,5 +19,3 @@ LIB_OBJS= \
_OBJS_VAR := LIB_OBJS _OBJS_VAR := LIB_OBJS
include ../objs.mk include ../objs.mk
$(OUT)librsn_supp.a: $(LIB_OBJS)
$(AR) crT $@ $?

View File

@ -1,5 +1,3 @@
ALL=$(OUT)libtls.a
include ../lib.rules include ../lib.rules
install: install:
@ -33,5 +31,3 @@ LIB_OBJS= \
_OBJS_VAR := LIB_OBJS _OBJS_VAR := LIB_OBJS
include ../objs.mk include ../objs.mk
$(OUT)libtls.a: $(LIB_OBJS)
$(AR) crT $@ $?

View File

@ -1,5 +1,3 @@
ALL=$(OUT)libutils.a
include ../lib.rules include ../lib.rules
install: install:
@ -36,5 +34,3 @@ LIB_OBJS += edit.o
_OBJS_VAR := LIB_OBJS _OBJS_VAR := LIB_OBJS
include ../objs.mk include ../objs.mk
$(OUT)libutils.a: $(LIB_OBJS)
$(AR) crT $@ $?

View File

@ -1,5 +1,3 @@
ALL=$(OUT)libwps.a
include ../lib.rules include ../lib.rules
install: install:
@ -35,5 +33,3 @@ LIB_OBJS= \
_OBJS_VAR := LIB_OBJS _OBJS_VAR := LIB_OBJS
include ../objs.mk include ../objs.mk
$(OUT)libwps.a: $(LIB_OBJS)
$(AR) crT $@ $?