In preparation for more source files, rework the Makefile to handle prerequisites more generically, making it easier to isolate future changes. Also update PHONY targets. Signed-off-by: David E. Box <david.e.box@xxxxxxxxxxxxxxx> --- V2 - New Patch. tools/arch/x86/intel_sdsi/Makefile | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/tools/arch/x86/intel_sdsi/Makefile b/tools/arch/x86/intel_sdsi/Makefile index 5de2288cda79..47b6fd98372c 100644 --- a/tools/arch/x86/intel_sdsi/Makefile +++ b/tools/arch/x86/intel_sdsi/Makefile @@ -1,21 +1,25 @@ # SPDX-License-Identifier: GPL-2.0 # Makefile for Intel Software Defined Silicon provisioning tool - -intel_sdsi: intel_sdsi.c - -CFLAGS = -Wextra - +include ../../../scripts/Makefile.include BINDIR ?= /usr/sbin -override CFLAGS += -O2 -Wall +SRCS = intel_sdsi.c -%: %.c - $(CC) $(CFLAGS) -o $@ $< $(LDFLAGS) +OBJS = $(SRCS:.c=.o) + +override CFLAGS += -O2 -Wall -Wextra + +intel_sdsi: $(OBJS) + $(CC) $(CFLAGS) $(OBJS) -o $@ + +%.o: %.c + $(CC) $(CFLAGS) -c $< -o $@ -.PHONY : clean clean : - @rm -f intel_sdsi + @rm -f intel_sdsi $(OBJS) install : intel_sdsi install -d $(DESTDIR)$(BINDIR) install -m 755 -p intel_sdsi $(DESTDIR)$(BINDIR)/intel_sdsi + +.PHONY : clean install -- 2.34.1