162306a36Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0
262306a36Sopenharmony_ciobj-$(CONFIG_CFG80211) += cfg80211.o
362306a36Sopenharmony_ciobj-$(CONFIG_LIB80211) += lib80211.o
462306a36Sopenharmony_ciobj-$(CONFIG_LIB80211_CRYPT_WEP) += lib80211_crypt_wep.o
562306a36Sopenharmony_ciobj-$(CONFIG_LIB80211_CRYPT_CCMP) += lib80211_crypt_ccmp.o
662306a36Sopenharmony_ciobj-$(CONFIG_LIB80211_CRYPT_TKIP) += lib80211_crypt_tkip.o
762306a36Sopenharmony_ci
862306a36Sopenharmony_ciobj-$(CONFIG_WEXT_CORE) += wext-core.o
962306a36Sopenharmony_ciobj-$(CONFIG_WEXT_PROC) += wext-proc.o
1062306a36Sopenharmony_ciobj-$(CONFIG_WEXT_SPY) += wext-spy.o
1162306a36Sopenharmony_ciobj-$(CONFIG_WEXT_PRIV) += wext-priv.o
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_cicfg80211-y += core.o sysfs.o radiotap.o util.o reg.o scan.o nl80211.o
1462306a36Sopenharmony_cicfg80211-y += mlme.o ibss.o sme.o chan.o ethtool.o mesh.o ap.o trace.o ocb.o
1562306a36Sopenharmony_cicfg80211-y += pmsr.o
1662306a36Sopenharmony_cicfg80211-$(CONFIG_OF) += of.o
1762306a36Sopenharmony_cicfg80211-$(CONFIG_CFG80211_DEBUGFS) += debugfs.o
1862306a36Sopenharmony_cicfg80211-$(CONFIG_CFG80211_WEXT) += wext-compat.o wext-sme.o
1962306a36Sopenharmony_ci
2062306a36Sopenharmony_ciCFLAGS_trace.o := -I$(src)
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_cicfg80211-$(CONFIG_CFG80211_USE_KERNEL_REGDB_KEYS) += shipped-certs.o
2362306a36Sopenharmony_ciifneq ($(CONFIG_CFG80211_EXTRA_REGDB_KEYDIR),)
2462306a36Sopenharmony_cicfg80211-y += extra-certs.o
2562306a36Sopenharmony_ciendif
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_ci$(obj)/shipped-certs.c: $(wildcard $(srctree)/$(src)/certs/*.hex)
2862306a36Sopenharmony_ci	@$(kecho) "  GEN     $@"
2962306a36Sopenharmony_ci	$(Q)(echo '#include "reg.h"'; \
3062306a36Sopenharmony_ci	  echo 'const u8 shipped_regdb_certs[] = {'; \
3162306a36Sopenharmony_ci	  echo | cat - $^ ; \
3262306a36Sopenharmony_ci	  echo '};'; \
3362306a36Sopenharmony_ci	  echo 'unsigned int shipped_regdb_certs_len = sizeof(shipped_regdb_certs);'; \
3462306a36Sopenharmony_ci	 ) > $@
3562306a36Sopenharmony_ci
3662306a36Sopenharmony_ci$(obj)/extra-certs.c: $(CONFIG_CFG80211_EXTRA_REGDB_KEYDIR) \
3762306a36Sopenharmony_ci		      $(wildcard $(CONFIG_CFG80211_EXTRA_REGDB_KEYDIR)/*.x509)
3862306a36Sopenharmony_ci	@$(kecho) "  GEN     $@"
3962306a36Sopenharmony_ci	$(Q)(set -e; \
4062306a36Sopenharmony_ci	  allf=""; \
4162306a36Sopenharmony_ci	  for f in $^ ; do \
4262306a36Sopenharmony_ci	      test -f $$f || continue;\
4362306a36Sopenharmony_ci	      # similar to hexdump -v -e '1/1 "0x%.2x," "\n"' \
4462306a36Sopenharmony_ci	      thisf=$$(od -An -v -tx1 < $$f | \
4562306a36Sopenharmony_ci	                   sed -e 's/ /\n/g' | \
4662306a36Sopenharmony_ci	                   sed -e 's/^[0-9a-f]\+$$/\0/;t;d' | \
4762306a36Sopenharmony_ci	                   sed -e 's/^/0x/;s/$$/,/'); \
4862306a36Sopenharmony_ci	      # file should not be empty - maybe command substitution failed? \
4962306a36Sopenharmony_ci	      test ! -z "$$thisf";\
5062306a36Sopenharmony_ci	      allf=$$allf$$thisf;\
5162306a36Sopenharmony_ci	  done; \
5262306a36Sopenharmony_ci	  ( \
5362306a36Sopenharmony_ci	      echo '#include "reg.h"'; \
5462306a36Sopenharmony_ci	      echo 'const u8 extra_regdb_certs[] = {'; \
5562306a36Sopenharmony_ci	      echo "$$allf"; \
5662306a36Sopenharmony_ci	      echo '};'; \
5762306a36Sopenharmony_ci	      echo 'unsigned int extra_regdb_certs_len = sizeof(extra_regdb_certs);'; \
5862306a36Sopenharmony_ci	  ) > $@)
5962306a36Sopenharmony_ci
6062306a36Sopenharmony_ciclean-files += shipped-certs.c extra-certs.c
61