build: Pull common fragments into a build.rules file

Some things are used by most of the binaries, pull them
into a common rule fragment that we can use properly.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
Johannes Berg 2020-09-18 11:49:48 +02:00 committed by Jouni Malinen
parent 21cc50a434
commit a41a29192e
9 changed files with 74 additions and 212 deletions

43
src/build.rules Normal file
View file

@ -0,0 +1,43 @@
.PHONY: all
all: $(VERIFY) $(ALL) $(EXTRA_TARGETS)
ifndef CC
CC=gcc
endif
ifndef RANLIB
RANLIB=ranlib
endif
ifndef LDO
LDO=$(CC)
endif
ifndef CFLAGS
CFLAGS = -MMD -O2 -Wall -g
endif
Q=@
E=echo
ifeq ($(V), 1)
Q=
E=true
endif
ifeq ($(QUIET), 1)
Q=@
E=true
endif
ifeq ($(Q),@)
MAKEFLAGS += --no-print-directory
endif
ifdef CONFIG_CODE_COVERAGE
%.o: %.c
@$(E) " CC " $<
$(Q)cd $(dir $@); $(CC) -c -o $(notdir $@) $(CFLAGS) $(notdir $<)
else
%.o: %.c
$(Q)$(CC) -c -o $@ $(CFLAGS) $<
@$(E) " CC " $<
endif