13fb4f7cdSSrinivas Pandruvada# SPDX-License-Identifier: GPL-2.0 23fb4f7cdSSrinivas Pandruvadainclude ../../../scripts/Makefile.include 33fb4f7cdSSrinivas Pandruvada 43fb4f7cdSSrinivas Pandruvadabindir ?= /usr/bin 53fb4f7cdSSrinivas Pandruvada 63fb4f7cdSSrinivas Pandruvadaifeq ($(srctree),) 73fb4f7cdSSrinivas Pandruvadasrctree := $(patsubst %/,%,$(dir $(CURDIR))) 83fb4f7cdSSrinivas Pandruvadasrctree := $(patsubst %/,%,$(dir $(srctree))) 93fb4f7cdSSrinivas Pandruvadasrctree := $(patsubst %/,%,$(dir $(srctree))) 103fb4f7cdSSrinivas Pandruvadasrctree := $(patsubst %/,%,$(dir $(srctree))) 113fb4f7cdSSrinivas Pandruvadaendif 123fb4f7cdSSrinivas Pandruvada 133fb4f7cdSSrinivas Pandruvada# Do not use make's built-in rules 143fb4f7cdSSrinivas Pandruvada# (this improves performance and avoids hard-to-debug behaviour); 153fb4f7cdSSrinivas PandruvadaMAKEFLAGS += -r 167d440da0SSrinivas Pandruvadaoverride CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include -I/usr/include/libnl3 177d440da0SSrinivas Pandruvadaoverride LDFLAGS += -lnl-genl-3 -lnl-3 183fb4f7cdSSrinivas Pandruvada 193fb4f7cdSSrinivas PandruvadaALL_TARGETS := intel-speed-select 203fb4f7cdSSrinivas PandruvadaALL_PROGRAMS := $(patsubst %,$(OUTPUT)%,$(ALL_TARGETS)) 213fb4f7cdSSrinivas Pandruvada 223fb4f7cdSSrinivas Pandruvadaall: $(ALL_PROGRAMS) 233fb4f7cdSSrinivas Pandruvada 243fb4f7cdSSrinivas Pandruvadaexport srctree OUTPUT CC LD CFLAGS 253fb4f7cdSSrinivas Pandruvadainclude $(srctree)/tools/build/Makefile.include 263fb4f7cdSSrinivas Pandruvada 273fb4f7cdSSrinivas Pandruvada# 283fb4f7cdSSrinivas Pandruvada# We need the following to be outside of kernel tree 293fb4f7cdSSrinivas Pandruvada# 303fb4f7cdSSrinivas Pandruvada$(OUTPUT)include/linux/isst_if.h: ../../../../include/uapi/linux/isst_if.h 313fb4f7cdSSrinivas Pandruvada mkdir -p $(OUTPUT)include/linux 2>&1 || true 323fb4f7cdSSrinivas Pandruvada ln -sf $(CURDIR)/../../../../include/uapi/linux/isst_if.h $@ 333fb4f7cdSSrinivas Pandruvada 347d440da0SSrinivas Pandruvada$(OUTPUT)include/linux/thermal.h: ../../../../include/uapi/linux/thermal.h 357d440da0SSrinivas Pandruvada mkdir -p $(OUTPUT)include/linux 2>&1 || true 367d440da0SSrinivas Pandruvada ln -sf $(CURDIR)/../../../../include/uapi/linux/thermal.h $@ 377d440da0SSrinivas Pandruvada 387d440da0SSrinivas Pandruvadaprepare: $(OUTPUT)include/linux/isst_if.h $(OUTPUT)include/linux/thermal.h 393fb4f7cdSSrinivas Pandruvada 403fb4f7cdSSrinivas PandruvadaISST_IN := $(OUTPUT)intel-speed-select-in.o 413fb4f7cdSSrinivas Pandruvada 423fb4f7cdSSrinivas Pandruvada$(ISST_IN): prepare FORCE 433fb4f7cdSSrinivas Pandruvada $(Q)$(MAKE) $(build)=intel-speed-select 443fb4f7cdSSrinivas Pandruvada$(OUTPUT)intel-speed-select: $(ISST_IN) 45*b2dd71f9SHerton R. Krzesinski $(QUIET_LINK)$(CC) $(CFLAGS) $< $(LDFLAGS) -o $@ 463fb4f7cdSSrinivas Pandruvada 473fb4f7cdSSrinivas Pandruvadaclean: 483fb4f7cdSSrinivas Pandruvada rm -f $(ALL_PROGRAMS) 493fb4f7cdSSrinivas Pandruvada rm -rf $(OUTPUT)include/linux/isst_if.h 505c816641SMasahiro Yamada find $(or $(OUTPUT),.) -name '*.o' -delete -o -name '\.*.d' -delete 513fb4f7cdSSrinivas Pandruvada 523fb4f7cdSSrinivas Pandruvadainstall: $(ALL_PROGRAMS) 533fb4f7cdSSrinivas Pandruvada install -d -m 755 $(DESTDIR)$(bindir); \ 543fb4f7cdSSrinivas Pandruvada for program in $(ALL_PROGRAMS); do \ 553fb4f7cdSSrinivas Pandruvada install $$program $(DESTDIR)$(bindir); \ 563fb4f7cdSSrinivas Pandruvada done 573fb4f7cdSSrinivas Pandruvada 583fb4f7cdSSrinivas PandruvadaFORCE: 593fb4f7cdSSrinivas Pandruvada 603fb4f7cdSSrinivas Pandruvada.PHONY: all install clean FORCE prepare 61