build: Put archive files into build/ folder too

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@intel.com>
This commit is contained in:
Johannes Berg 2020-10-11 09:58:58 +02:00 committed by Jouni Malinen
parent 00b5e99b65
commit 87098d3324
38 changed files with 121 additions and 145 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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 $@ $?

View File

@ -9,9 +9,14 @@ ROOTDIR := $(dir $(lastword $(MAKEFILE_LIST)))
ROOTDIR := $(dir $(ROOTDIR:%../src/=%))../
BUILDDIR ?= $(abspath $(ROOTDIR)build)
BUILDDIR := $(BUILDDIR:%/=%)
_PROJ := $(abspath $(dir $(firstword $(MAKEFILE_LIST))))
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
@ -88,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)

View File

@ -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 $@ $?

View File

@ -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 $@ $?

View File

@ -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 $@ $?

View File

@ -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 $@ $?

View File

@ -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 $@ $?

View File

@ -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 $@ $?

View File

@ -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 $@ $?

View File

@ -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 $@ $?

View File

@ -1,3 +1,3 @@
$(_OBJS_VAR) := $(call BUILDOBJ,$($(_OBJS_VAR)))
-include $($(_OBJS_VAR):%.o=%.d)
-include $($($(_OBJS_VAR):%.o=%.d):%.a=%.d)
_DIRS += $(dir $($(_OBJS_VAR)))

View File

@ -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 $@ $?

View File

@ -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 $@ $?

View File

@ -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 $@ $?

View File

@ -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 $@ $?

View File

@ -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 $@ $?

View File

@ -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 $@ $?

View File

@ -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)

View File

@ -31,6 +31,12 @@ OBJS += ap-mgmt.o
_OBJS_VAR := OBJS
include ../../../src/objs.mk
_OBJS_VAR := LIBS
include ../../../src/objs.mk
_OBJS_VAR := ELIBS
include ../../../src/objs.mk
ap-mgmt: $(OBJS) $(LIBS)
$(LDO) $(LDFLAGS) -o $@ $^ $(LIBS) $(ELIBS)

View File

@ -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)

View File

@ -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

View File

@ -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 " $@

View File

@ -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 " $@

View File

@ -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 " $@

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)