[PATCH v5 13/15] build: put archive files into build/ folder too

Johannes Berg johannes at sipsolutions.net
Wed Sep 9 18:04:00 EDT 2020


From: Johannes Berg <johannes.berg at intel.com>

This is something I hadn't previously done, but there are
cases where it's needed, e.g. building 'wlantest' and then
one of the tests/fuzzing/*/ projects, they use a different
configuration (fuzzing vs. not fuzzing).

Perhaps more importantly, this gets rid of the last thing
that was dumped into the source directories, apart from
the binaries themselves.

Note that due to the use of thin archives, this required
building with absolute paths.

Signed-off-by: Johannes Berg <johannes.berg at intel.com>
---
 eap_example/Makefile                     | 11 +-----
 radius_example/Makefile                  | 12 ++----
 src/ap/Makefile                          |  4 +-
 src/build.rules                          | 14 ++++++-
 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/p2p/Makefile                         |  4 +-
 src/radius/Makefile                      |  4 +-
 src/rsn_supp/Makefile                    |  4 +-
 src/tls/Makefile                         |  4 +-
 src/utils/Makefile                       |  4 +-
 src/wps/Makefile                         |  4 +-
 tests/Makefile                           | 50 ++++--------------------
 tests/fuzzing/ap-mgmt/Makefile           |  3 ++
 tests/fuzzing/asn1/Makefile              |  3 ++
 tests/fuzzing/dpp-uri/Makefile           |  3 ++
 tests/fuzzing/eap-aka-peer/Makefile      |  3 ++
 tests/fuzzing/eap-mschapv2-peer/Makefile |  3 ++
 tests/fuzzing/eap-sim-peer/Makefile      |  3 ++
 tests/fuzzing/eapol-key-auth/Makefile    |  3 ++
 tests/fuzzing/eapol-key-supp/Makefile    |  3 ++
 tests/fuzzing/eapol-supp/Makefile        |  3 ++
 tests/fuzzing/json/Makefile              |  3 ++
 tests/fuzzing/p2p/Makefile               |  3 ++
 tests/fuzzing/rules.include              | 46 +---------------------
 tests/fuzzing/sae/Makefile               |  3 ++
 tests/fuzzing/tls-client/Makefile        |  6 +++
 tests/fuzzing/tls-server/Makefile        |  6 +++
 tests/fuzzing/wnm/Makefile               |  6 +++
 tests/fuzzing/x509/Makefile              |  6 +++
 wlantest/Makefile                        |  9 +----
 37 files changed, 118 insertions(+), 144 deletions(-)

diff --git a/eap_example/Makefile b/eap_example/Makefile
index 7660b8ddd036..691466f03c9a 100644
--- a/eap_example/Makefile
+++ b/eap_example/Makefile
@@ -90,15 +90,8 @@ OBJS_ex = eap_example.o eap_example_peer.o eap_example_server.o
 _OBJS_VAR := OBJS_ex
 include ../src/objs.mk
 
-
-../src/utils/libutils.a:
-	$(MAKE) -C ../src/utils
-
-../src/crypto/libcrypto.a:
-	$(MAKE) -C ../src/crypto
-
-../src/tls/libtls.a:
-	$(MAKE) -C ../src/tls
+_OBJS_VAR := EAP_LIBS
+include ../src/objs.mk
 
 
 ifneq ($(CONFIG_SOLIB), yes)
diff --git a/radius_example/Makefile b/radius_example/Makefile
index f0e4e535aa3c..d58a82c340c6 100644
--- a/radius_example/Makefile
+++ b/radius_example/Makefile
@@ -11,15 +11,6 @@ LIBS += ../src/crypto/libcrypto.a
 LIBS += ../src/utils/libutils.a
 LLIBS = -lrt
 
-../src/utils/libutils.a:
-	$(MAKE) -C ../src/utils
-
-../src/crypto/libcrypto.a:
-	$(MAKE) -C ../src/crypto
-
-../src/radius/libradius.a:
-	$(MAKE) -C ../src/radius
-
 #CLAGS += -DCONFIG_IPV6
 
 OBJS_ex = radius_example.o
@@ -27,6 +18,9 @@ OBJS_ex = radius_example.o
 _OBJS_VAR := OBJS_ex
 include ../src/objs.mk
 
+_OBJS_VAR := LIBS
+include ../src/objs.mk
+
 radius_example: $(OBJS_ex) $(LIBS)
 	$(LDO) $(LDFLAGS) -o radius_example $(OBJS_ex) $(LIBS) $(LLIBS)
 
diff --git a/src/ap/Makefile b/src/ap/Makefile
index 425b123405a4..09d54924cb7e 100644
--- a/src/ap/Makefile
+++ b/src/ap/Makefile
@@ -1,4 +1,4 @@
-ALL=libap.a
+ALL=$(OUT)libap.a
 
 include ../lib.rules
 
@@ -67,5 +67,5 @@ LIB_OBJS= \
 
 _OBJS_VAR := LIB_OBJS
 include ../objs.mk
-libap.a: $(LIB_OBJS)
+$(OUT)libap.a: $(LIB_OBJS)
 	$(AR) crT $@ $?
diff --git a/src/build.rules b/src/build.rules
index 2437a05eee9d..1b830490cfe0 100644
--- a/src/build.rules
+++ b/src/build.rules
@@ -8,9 +8,15 @@ all: _all
 ROOTDIR := $(dir $(lastword $(MAKEFILE_LIST)))
 ROOTDIR := $(dir $(ROOTDIR:%../src/=%))../
 BUILDDIR := $(ROOTDIR)build
-_PROJ := $(abspath $(dir $(firstword $(MAKEFILE_LIST))))
+BUILDDIR := $(abspath $(BUILDDIR))
 ABSROOT := $(abspath $(ROOTDIR))
+ifeq ($(origin OUT),command line)
+_PROJ := $(OUT:%/=%)
+_PROJ := $(_PROJ:$(BUILDDIR)/%=%)
+else
+_PROJ := $(abspath $(dir $(firstword $(MAKEFILE_LIST))))
 _PROJ := $(_PROJ:$(ABSROOT)/%=%)
+endif
 
 ifndef CC
 CC=gcc
@@ -87,9 +93,13 @@ $(BUILDDIR)/$(PROJ)/wpa_supplicant/%.o: $(ROOTDIR)wpa_supplicant/%.c $(CONFIG_FI
 	$(Q)$(CC) -c -o $@ $(CFLAGS) $<
 	@$(E) "  CC " $<
 
+# libraries - they know how to build themselves
+$(BUILDDIR)/$(PROJ)/%.a: $(CONFIG_FILE)
+	$(Q)mkdir -p $(BUILDDIR)/$(PROJ)/$(dir $(@:$(BUILDDIR)/$(PROJ)/%=%))
+	$(Q)$(MAKE) -C $(ROOTDIR)$(dir $(@:$(BUILDDIR)/$(PROJ)/%=%)) OUT=$(abspath $(dir $@))/
+
 BUILDOBJ = $(patsubst %,$(BUILDDIR)/$(PROJ)/%,$(patsubst $(ROOTDIR)%,%,$(1)))
 
 .PHONY: common-clean
 common-clean:
-	$(Q)$(MAKE) -C $(ROOTDIR)/src clean
 	$(Q)rm -rf $(ALL) $(BUILDDIR)/$(PROJ)
diff --git a/src/common/Makefile b/src/common/Makefile
index 4cd48d9fd8ce..19573ebd30e0 100644
--- a/src/common/Makefile
+++ b/src/common/Makefile
@@ -1,4 +1,4 @@
-ALL=libcommon.a
+ALL=$(OUT)libcommon.a
 
 include ../lib.rules
 
@@ -21,5 +21,5 @@ LIB_OBJS= \
 
 _OBJS_VAR := LIB_OBJS
 include ../objs.mk
-libcommon.a: $(LIB_OBJS)
+$(OUT)libcommon.a: $(LIB_OBJS)
 	$(AR) crT $@ $?
diff --git a/src/crypto/Makefile b/src/crypto/Makefile
index 3af5406ea381..b8accd81c583 100644
--- a/src/crypto/Makefile
+++ b/src/crypto/Makefile
@@ -1,4 +1,4 @@
-ALL=libcrypto.a
+ALL=$(OUT)libcrypto.a
 
 include ../lib.rules
 
@@ -68,5 +68,5 @@ endif
 
 _OBJS_VAR := LIB_OBJS
 include ../objs.mk
-libcrypto.a: $(LIB_OBJS)
+$(OUT)libcrypto.a: $(LIB_OBJS)
 	$(AR) crT $@ $?
diff --git a/src/eap_common/Makefile b/src/eap_common/Makefile
index 49fbbde02691..b50a4b731412 100644
--- a/src/eap_common/Makefile
+++ b/src/eap_common/Makefile
@@ -1,4 +1,4 @@
-ALL=libeap_common.a
+ALL=$(OUT)libeap_common.a
 
 include ../lib.rules
 
@@ -25,5 +25,5 @@ LIB_OBJS= \
 
 _OBJS_VAR := LIB_OBJS
 include ../objs.mk
-libeap_common.a: $(LIB_OBJS)
+$(OUT)libeap_common.a: $(LIB_OBJS)
 	$(AR) crT $@ $?
diff --git a/src/eap_peer/Makefile b/src/eap_peer/Makefile
index 36439b788379..d7a0372ad761 100644
--- a/src/eap_peer/Makefile
+++ b/src/eap_peer/Makefile
@@ -1,4 +1,4 @@
-ALL=libeap_peer.a
+ALL=$(OUT)libeap_peer.a
 
 include ../lib.rules
 
@@ -17,5 +17,5 @@ LIB_OBJS= \
 
 _OBJS_VAR := LIB_OBJS
 include ../objs.mk
-libeap_peer.a: $(LIB_OBJS)
+$(OUT)libeap_peer.a: $(LIB_OBJS)
 	$(AR) crT $@ $?
diff --git a/src/eap_server/Makefile b/src/eap_server/Makefile
index 946ac195e251..b4261ec39263 100644
--- a/src/eap_server/Makefile
+++ b/src/eap_server/Makefile
@@ -1,4 +1,4 @@
-ALL=libeap_server.a
+ALL=$(OUT)libeap_server.a
 
 include ../lib.rules
 
@@ -15,5 +15,5 @@ LIB_OBJS= \
 
 _OBJS_VAR := LIB_OBJS
 include ../objs.mk
-libeap_server.a: $(LIB_OBJS)
+$(OUT)libeap_server.a: $(LIB_OBJS)
 	$(AR) crT $@ $?
diff --git a/src/eapol_auth/Makefile b/src/eapol_auth/Makefile
index 777979ce7c4f..aa597eda4499 100644
--- a/src/eapol_auth/Makefile
+++ b/src/eapol_auth/Makefile
@@ -1,4 +1,4 @@
-ALL=libeapol_auth.a
+ALL=$(OUT)libeapol_auth.a
 
 include ../lib.rules
 
@@ -10,5 +10,5 @@ LIB_OBJS = eapol_auth_sm.o eapol_auth_dump.o
 
 _OBJS_VAR := LIB_OBJS
 include ../objs.mk
-libeapol_auth.a: $(LIB_OBJS)
+$(OUT)libeapol_auth.a: $(LIB_OBJS)
 	$(AR) crT $@ $?
diff --git a/src/eapol_supp/Makefile b/src/eapol_supp/Makefile
index 265e5f25c37c..453e49e6bf4b 100644
--- a/src/eapol_supp/Makefile
+++ b/src/eapol_supp/Makefile
@@ -1,4 +1,4 @@
-ALL=libeapol_supp.a
+ALL=$(OUT)libeapol_supp.a
 
 include ../lib.rules
 
@@ -12,5 +12,5 @@ LIB_OBJS = eapol_supp_sm.o
 
 _OBJS_VAR := LIB_OBJS
 include ../objs.mk
-libeapol_supp.a: $(LIB_OBJS)
+$(OUT)libeapol_supp.a: $(LIB_OBJS)
 	$(AR) crT $@ $?
diff --git a/src/l2_packet/Makefile b/src/l2_packet/Makefile
index ab8c86ecc43d..870d652bc63e 100644
--- a/src/l2_packet/Makefile
+++ b/src/l2_packet/Makefile
@@ -1,4 +1,4 @@
-ALL=libl2_packet.a
+ALL=$(OUT)libl2_packet.a
 
 include ../lib.rules
 
@@ -10,5 +10,5 @@ LIB_OBJS = l2_packet_linux.o
 
 _OBJS_VAR := LIB_OBJS
 include ../objs.mk
-libl2_packet.a: $(LIB_OBJS)
+$(OUT)libl2_packet.a: $(LIB_OBJS)
 	$(AR) crT $@ $?
diff --git a/src/p2p/Makefile b/src/p2p/Makefile
index c6b406661182..00e1908f0bc1 100644
--- a/src/p2p/Makefile
+++ b/src/p2p/Makefile
@@ -1,4 +1,4 @@
-ALL=libp2p.a
+ALL=$(OUT)libp2p.a
 
 include ../lib.rules
 
@@ -23,5 +23,5 @@ LIB_OBJS= \
 
 _OBJS_VAR := LIB_OBJS
 include ../objs.mk
-libp2p.a: $(LIB_OBJS)
+$(OUT)libp2p.a: $(LIB_OBJS)
 	$(AR) crT $@ $?
diff --git a/src/radius/Makefile b/src/radius/Makefile
index 83096f0c7fbb..5cefa390fab9 100644
--- a/src/radius/Makefile
+++ b/src/radius/Makefile
@@ -1,4 +1,4 @@
-ALL=libradius.a
+ALL=$(OUT)libradius.a
 
 include ../lib.rules
 
@@ -16,5 +16,5 @@ LIB_OBJS= \
 
 _OBJS_VAR := LIB_OBJS
 include ../objs.mk
-libradius.a: $(LIB_OBJS)
+$(OUT)libradius.a: $(LIB_OBJS)
 	$(AR) crT $@ $?
diff --git a/src/rsn_supp/Makefile b/src/rsn_supp/Makefile
index 43288e3fd688..f5f5cad17dfb 100644
--- a/src/rsn_supp/Makefile
+++ b/src/rsn_supp/Makefile
@@ -1,4 +1,4 @@
-ALL=librsn_supp.a
+ALL=$(OUT)librsn_supp.a
 
 include ../lib.rules
 
@@ -21,5 +21,5 @@ LIB_OBJS= \
 
 _OBJS_VAR := LIB_OBJS
 include ../objs.mk
-librsn_supp.a: $(LIB_OBJS)
+$(OUT)librsn_supp.a: $(LIB_OBJS)
 	$(AR) crT $@ $?
diff --git a/src/tls/Makefile b/src/tls/Makefile
index 3fac5ee8c6cd..5483345e5331 100644
--- a/src/tls/Makefile
+++ b/src/tls/Makefile
@@ -1,4 +1,4 @@
-ALL=libtls.a
+ALL=$(OUT)libtls.a
 
 include ../lib.rules
 
@@ -33,5 +33,5 @@ LIB_OBJS= \
 
 _OBJS_VAR := LIB_OBJS
 include ../objs.mk
-libtls.a: $(LIB_OBJS)
+$(OUT)libtls.a: $(LIB_OBJS)
 	$(AR) crT $@ $?
diff --git a/src/utils/Makefile b/src/utils/Makefile
index 7be05101fc30..91aba38466ff 100644
--- a/src/utils/Makefile
+++ b/src/utils/Makefile
@@ -1,4 +1,4 @@
-ALL=libutils.a
+ALL=$(OUT)libutils.a
 
 include ../lib.rules
 
@@ -36,5 +36,5 @@ LIB_OBJS += edit.o
 
 _OBJS_VAR := LIB_OBJS
 include ../objs.mk
-libutils.a: $(LIB_OBJS)
+$(OUT)libutils.a: $(LIB_OBJS)
 	$(AR) crT $@ $?
diff --git a/src/wps/Makefile b/src/wps/Makefile
index ed928ef41e94..79106952783d 100644
--- a/src/wps/Makefile
+++ b/src/wps/Makefile
@@ -1,4 +1,4 @@
-ALL=libwps.a
+ALL=$(OUT)libwps.a
 
 include ../lib.rules
 
@@ -35,5 +35,5 @@ LIB_OBJS= \
 
 _OBJS_VAR := LIB_OBJS
 include ../objs.mk
-libwps.a: $(LIB_OBJS)
+$(OUT)libwps.a: $(LIB_OBJS)
 	$(AR) crT $@ $?
diff --git a/tests/Makefile b/tests/Makefile
index c8ba3f21c0b8..72fb8ee4f501 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -42,55 +42,19 @@ DLIBS = ../src/crypto/libcrypto.a \
 	../src/rsn_supp/librsn_supp.a \
 	../src/tls/libtls.a
 
+_OBJS_VAR := LLIBS
+include ../src/objs.mk
+_OBJS_VAR := SLIBS
+include ../src/objs.mk
+_OBJS_VAR := DLIBS
+include ../src/objs.mk
+
 LIBS = $(SLIBS) $(DLIBS)
 LLIBS = -Wl,--start-group $(DLIBS) -Wl,--end-group $(SLIBS)
 
 # glibc < 2.17 needs -lrt for clock_gettime()
 LLIBS += -lrt
 
-../src/utils/libutils.a:
-	$(MAKE) -C ../src/utils
-
-../src/common/libcommon.a:
-	$(MAKE) -C ../src/common
-
-../src/crypto/libcrypto.a:
-	$(MAKE) -C ../src/crypto
-
-../src/tls/libtls.a:
-	$(MAKE) -C ../src/tls
-
-../src/ap/libap.a:
-	$(MAKE) -C ../src/ap
-
-../src/radius/libradius.a:
-	$(MAKE) -C ../src/radius
-
-../src/l2_packet/libl2_packet.a:
-	$(MAKE) -C ../src/l2_packet
-
-../src/wps/libwps.a:
-	$(MAKE) -C ../src/wps
-
-../src/eap_peer/libeap_peer.a:
-	$(MAKE) -C ../src/eap_peer
-
-../src/eap_server/libeap_server.a:
-	$(MAKE) -C ../src/eap_server
-
-../src/eap_common/libeap_common.a:
-	$(MAKE) -C ../src/eap_common
-
-../src/eapol_auth/libeapol_auth.a:
-	$(MAKE) -C ../src/eapol_auth
-
-../src/eapol_supp/libeapol_supp.a:
-	$(MAKE) -C ../src/eapol_supp
-
-../src/rsn_supp/librsn_supp.a:
-	$(MAKE) -C ../src/rsn_supp
-
-
 test-aes: $(call BUILDOBJ,test-aes.o) $(LIBS)
 	$(LDO) $(LDFLAGS) -o $@ $^ $(LLIBS)
 
diff --git a/tests/fuzzing/ap-mgmt/Makefile b/tests/fuzzing/ap-mgmt/Makefile
index 159c7c3f8106..16998569e377 100644
--- a/tests/fuzzing/ap-mgmt/Makefile
+++ b/tests/fuzzing/ap-mgmt/Makefile
@@ -31,6 +31,9 @@ OBJS += ap-mgmt.o
 _OBJS_VAR := OBJS
 include ../../../src/objs.mk
 
+_OBJS_VAR := LIBS
+include ../../../src/objs.mk
+
 ap-mgmt: $(OBJS) $(LIBS)
 	$(LDO) $(LDFLAGS) -o $@ $^ $(LIBS) $(ELIBS)
 
diff --git a/tests/fuzzing/asn1/Makefile b/tests/fuzzing/asn1/Makefile
index fb8fbed684ef..274641a406bb 100644
--- a/tests/fuzzing/asn1/Makefile
+++ b/tests/fuzzing/asn1/Makefile
@@ -12,6 +12,9 @@ OBJS += asn1.o
 _OBJS_VAR := OBJS
 include ../../../src/objs.mk
 
+_OBJS_VAR := LIBS
+include ../../../src/objs.mk
+
 asn1: $(OBJS) $(LIBS)
 	$(LDO) $(LDFLAGS) -o $@ $^ $(LIBS) $(ELIBS)
 
diff --git a/tests/fuzzing/dpp-uri/Makefile b/tests/fuzzing/dpp-uri/Makefile
index aca8f02ad434..1c1bab631a04 100644
--- a/tests/fuzzing/dpp-uri/Makefile
+++ b/tests/fuzzing/dpp-uri/Makefile
@@ -33,6 +33,9 @@ OBJS += dpp-uri.o
 _OBJS_VAR := OBJS
 include ../../../src/objs.mk
 
+_OBJS_VAR := LIBS
+include ../../../src/objs.mk
+
 dpp-uri: $(OBJS) $(LIBS)
 	$(LDO) $(LDFLAGS) -o $@ $^ -lcrypto
 
diff --git a/tests/fuzzing/eap-aka-peer/Makefile b/tests/fuzzing/eap-aka-peer/Makefile
index bd960caa763e..c964f186d146 100644
--- a/tests/fuzzing/eap-aka-peer/Makefile
+++ b/tests/fuzzing/eap-aka-peer/Makefile
@@ -15,6 +15,9 @@ OBJS += eap-aka-peer.o
 _OBJS_VAR := OBJS
 include ../../../src/objs.mk
 
+_OBJS_VAR := LIBS
+include ../../../src/objs.mk
+
 eap-aka-peer: $(OBJS) $(LIBS)
 	$(Q)$(LDO) $(LDFLAGS) -o $@ $^ $(LIBS) $(ELIBS)
 	@$(E) "  LD " $@
diff --git a/tests/fuzzing/eap-mschapv2-peer/Makefile b/tests/fuzzing/eap-mschapv2-peer/Makefile
index 953855c85ed4..7290e90c62b7 100644
--- a/tests/fuzzing/eap-mschapv2-peer/Makefile
+++ b/tests/fuzzing/eap-mschapv2-peer/Makefile
@@ -14,6 +14,9 @@ OBJS += eap-mschapv2-peer.o
 _OBJS_VAR := OBJS
 include ../../../src/objs.mk
 
+_OBJS_VAR := LIBS
+include ../../../src/objs.mk
+
 eap-mschapv2-peer: $(OBJS) $(LIBS)
 	$(Q)$(LDO) $(LDFLAGS) -o $@ $^ $(LIBS) $(ELIBS)
 	@$(E) "  LD " $@
diff --git a/tests/fuzzing/eap-sim-peer/Makefile b/tests/fuzzing/eap-sim-peer/Makefile
index 9292ccb79b2d..9e728e4f476b 100644
--- a/tests/fuzzing/eap-sim-peer/Makefile
+++ b/tests/fuzzing/eap-sim-peer/Makefile
@@ -15,6 +15,9 @@ OBJS += eap-sim-peer.o
 _OBJS_VAR := OBJS
 include ../../../src/objs.mk
 
+_OBJS_VAR := LIBS
+include ../../../src/objs.mk
+
 eap-sim-peer: $(OBJS) $(LIBS)
 	$(Q)$(LDO) $(LDFLAGS) -o $@ $^ $(LIBS) $(ELIBS)
 	@$(E) "  LD " $@
diff --git a/tests/fuzzing/eapol-key-auth/Makefile b/tests/fuzzing/eapol-key-auth/Makefile
index bdc731ff4931..bd15b91f2394 100644
--- a/tests/fuzzing/eapol-key-auth/Makefile
+++ b/tests/fuzzing/eapol-key-auth/Makefile
@@ -24,6 +24,9 @@ OBJS += eapol-key-auth.o
 _OBJS_VAR := OBJS
 include ../../../src/objs.mk
 
+_OBJS_VAR := LIBS
+include ../../../src/objs.mk
+
 eapol-key-auth: $(OBJS) $(LIBS)
 	$(LDO) $(LDFLAGS) -o $@ $^ -Wl,--start-group $(LIBS) -Wl,--end-group
 
diff --git a/tests/fuzzing/eapol-key-supp/Makefile b/tests/fuzzing/eapol-key-supp/Makefile
index 29e419b7cd03..949e2efe991c 100644
--- a/tests/fuzzing/eapol-key-supp/Makefile
+++ b/tests/fuzzing/eapol-key-supp/Makefile
@@ -20,6 +20,9 @@ OBJS += eapol-key-supp.o
 _OBJS_VAR := OBJS
 include ../../../src/objs.mk
 
+_OBJS_VAR := LIBS
+include ../../../src/objs.mk
+
 eapol-key-supp: $(OBJS) $(LIBS)
 	$(LDO) $(LDFLAGS) -o $@ $^ -Wl,--start-group $(LIBS) -Wl,--end-group
 
diff --git a/tests/fuzzing/eapol-supp/Makefile b/tests/fuzzing/eapol-supp/Makefile
index 27e631148df1..ea32346b2df1 100644
--- a/tests/fuzzing/eapol-supp/Makefile
+++ b/tests/fuzzing/eapol-supp/Makefile
@@ -18,6 +18,9 @@ OBJS += eapol-supp.o
 _OBJS_VAR := OBJS
 include ../../../src/objs.mk
 
+_OBJS_VAR := LIBS
+include ../../../src/objs.mk
+
 eapol-supp: $(OBJS) $(LIBS)
 	$(LDO) $(LDFLAGS) -o $@ $^ -Wl,--start-group $(LIBS) -Wl,--end-group
 
diff --git a/tests/fuzzing/json/Makefile b/tests/fuzzing/json/Makefile
index 8de19293e29b..9dd51a5f22ef 100644
--- a/tests/fuzzing/json/Makefile
+++ b/tests/fuzzing/json/Makefile
@@ -13,6 +13,9 @@ OBJS += json.o
 _OBJS_VAR := OBJS
 include ../../../src/objs.mk
 
+_OBJS_VAR := LIBS
+include ../../../src/objs.mk
+
 json: $(OBJS) $(LIBS)
 	$(LDO) $(LDFLAGS) -o $@ $^ $(LIBS) $(ELIBS)
 
diff --git a/tests/fuzzing/p2p/Makefile b/tests/fuzzing/p2p/Makefile
index ef31a7505e28..acac9d38f1b1 100644
--- a/tests/fuzzing/p2p/Makefile
+++ b/tests/fuzzing/p2p/Makefile
@@ -13,6 +13,9 @@ OBJS += p2p.o
 _OBJS_VAR := OBJS
 include ../../../src/objs.mk
 
+_OBJS_VAR := LIBS
+include ../../../src/objs.mk
+
 p2p: $(OBJS) $(LIBS)
 	$(LDO) $(LDFLAGS) -o $@ $^ $(LIBS)
 
diff --git a/tests/fuzzing/rules.include b/tests/fuzzing/rules.include
index b2e8a81ea878..e2cf577af811 100644
--- a/tests/fuzzing/rules.include
+++ b/tests/fuzzing/rules.include
@@ -27,47 +27,5 @@ SRC=../../../src
 CFLAGS += -I$(SRC) -I$(SRC)/utils -I$(WPAS_SRC)
 OBJS += ../fuzzer-common.o
 
-$(SRC)/ap/libap.a:
-	$(MAKE) -C $(SRC)/ap TEST_FUZZ=y
-
-$(SRC)/common/libcommon.a:
-	$(MAKE) -C $(SRC)/common
-
-$(SRC)/crypto/libcrypto.a:
-	$(MAKE) -C $(SRC)/crypto TEST_FUZZ=y
-
-$(SRC)/eapol_auth/libeapol_auth.a:
-	$(MAKE) -C $(SRC)/eapol_auth
-
-$(SRC)/eapol_supp/libeapol_supp.a:
-	$(MAKE) -C $(SRC)/eapol_supp
-
-$(SRC)/eap_common/libeap_common.a:
-	$(MAKE) -C $(SRC)/eap_common
-
-$(SRC)/eap_peer/libeap_peer.a:
-	$(MAKE) -C $(SRC)/eap_peer
-
-$(SRC)/eap_server/libeap_server.a:
-	$(MAKE) -C $(SRC)/eap_server
-
-$(SRC)/l2_packet/libl2_packet.a:
-	$(MAKE) -C $(SRC)/l2_packet
-
-$(SRC)/p2p/libp2p.a:
-	$(MAKE) -C $(SRC)/p2p
-
-$(SRC)/radius/libradius.a:
-	$(MAKE) -C $(SRC)/radius
-
-$(SRC)/rsn_supp/librsn_supp.a:
-	$(MAKE) -C $(SRC)/rsn_supp TEST_FUZZ=y
-
-$(SRC)/tls/libtls.a:
-	$(MAKE) -C $(SRC)/tls TEST_FUZZ=y
-
-$(SRC)/utils/libutils.a:
-	$(MAKE) -C $(SRC)/utils TEST_FUZZ=y
-
-$(SRC)/wps/libwps.a:
-	$(MAKE) -C $(SRC)/wps
+# for the lib builds
+export TEST_FUZZ=y
diff --git a/tests/fuzzing/sae/Makefile b/tests/fuzzing/sae/Makefile
index ee7257afeaa8..ee4b0c0b6a22 100644
--- a/tests/fuzzing/sae/Makefile
+++ b/tests/fuzzing/sae/Makefile
@@ -18,6 +18,9 @@ OBJS += sae.o
 _OBJS_VAR := OBJS
 include ../../../src/objs.mk
 
+_OBJS_VAR := LIBS
+include ../../../src/objs.mk
+
 sae: $(OBJS) $(LIBS)
 	$(LDO) $(LDFLAGS) -o $@ $^ -lcrypto
 
diff --git a/tests/fuzzing/tls-client/Makefile b/tests/fuzzing/tls-client/Makefile
index 7d5e8d536fe7..84cfa0431566 100644
--- a/tests/fuzzing/tls-client/Makefile
+++ b/tests/fuzzing/tls-client/Makefile
@@ -19,6 +19,12 @@ OBJS += tls-client.o
 _OBJS_VAR := OBJS
 include ../../../src/objs.mk
 
+_OBJS_VAR := LIBS
+include ../../../src/objs.mk
+
+_OBJS_VAR := ELIBS
+include ../../../src/objs.mk
+
 tls-client: $(OBJS) $(LIBS)
 	$(LDO) $(LDFLAGS) -o $@ $^ $(LIBS) $(ELIBS)
 
diff --git a/tests/fuzzing/tls-server/Makefile b/tests/fuzzing/tls-server/Makefile
index 45304328e4b2..8e2400310397 100644
--- a/tests/fuzzing/tls-server/Makefile
+++ b/tests/fuzzing/tls-server/Makefile
@@ -19,6 +19,12 @@ OBJS += tls-server.o
 _OBJS_VAR := OBJS
 include ../../../src/objs.mk
 
+_OBJS_VAR := LIBS
+include ../../../src/objs.mk
+
+_OBJS_VAR := ELIBS
+include ../../../src/objs.mk
+
 tls-server: $(OBJS) $(LIBS)
 	$(LDO) $(LDFLAGS) -o $@ $^ $(LIBS) $(ELIBS)
 
diff --git a/tests/fuzzing/wnm/Makefile b/tests/fuzzing/wnm/Makefile
index f27dd341b333..73eab538765c 100644
--- a/tests/fuzzing/wnm/Makefile
+++ b/tests/fuzzing/wnm/Makefile
@@ -47,6 +47,12 @@ OBJS += wnm.o
 _OBJS_VAR := OBJS
 include ../../../src/objs.mk
 
+_OBJS_VAR := LIBS
+include ../../../src/objs.mk
+
+_OBJS_VAR := ELIBS
+include ../../../src/objs.mk
+
 wnm: $(OBJS) $(LIBS)
 	$(LDO) $(LDFLAGS) -o $@ $^ $(LIBS) $(ELIBS)
 
diff --git a/tests/fuzzing/x509/Makefile b/tests/fuzzing/x509/Makefile
index 7fff15a3a94a..306473c3dba3 100644
--- a/tests/fuzzing/x509/Makefile
+++ b/tests/fuzzing/x509/Makefile
@@ -14,6 +14,12 @@ OBJS += x509.o
 _OBJS_VAR := OBJS
 include ../../../src/objs.mk
 
+_OBJS_VAR := LIBS
+include ../../../src/objs.mk
+
+_OBJS_VAR := ELIBS
+include ../../../src/objs.mk
+
 x509: $(OBJS) $(LIBS)
 	$(LDO) $(LDFLAGS) -o $@ $^ $(LIBS) $(ELIBS)
 
diff --git a/wlantest/Makefile b/wlantest/Makefile
index 410c309d4745..602375112f2d 100644
--- a/wlantest/Makefile
+++ b/wlantest/Makefile
@@ -62,13 +62,6 @@ TOBJS += bip.o
 TOBJS += gcmp.o
 
 
-../src/utils/libutils.a:
-	$(MAKE) -C ../src/utils
-
-../src/crypto/libcrypto.a:
-	$(MAKE) -C ../src/crypto
-
-
 OBJS_cli = wlantest_cli.o
 
 _OBJS_VAR := OBJS
@@ -77,6 +70,8 @@ _OBJS_VAR := TOBJS
 include ../src/objs.mk
 _OBJS_VAR := OBJS_cli
 include ../src/objs.mk
+_OBJS_VAR := OWN_LIBS
+include ../src/objs.mk
 
 wlantest: $(OBJS) $(OWN_LIBS)
 	$(LDO) $(LDFLAGS) -o wlantest $(OBJS) $(OWN_LIBS) $(LIBS)
-- 
2.26.2




More information about the Hostap mailing list