brintos

brintos / linux-shallow public Read only

0
0
Text · 4.3 KiB · 82db451 Raw
159 lines · plain
1# SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause)2# Most of this file is copied from tools/lib/perf/Makefile3 4LIBTHERMAL_TOOLS_VERSION = 05LIBTHERMAL_TOOLS_PATCHLEVEL = 06LIBTHERMAL_TOOLS_EXTRAVERSION = 17 8MAKEFLAGS += --no-print-directory9 10ifeq ($(srctree),)11srctree := $(patsubst %/,%,$(dir $(CURDIR)))12srctree := $(patsubst %/,%,$(dir $(srctree)))13srctree := $(patsubst %/,%,$(dir $(srctree)))14# $(info Determined 'srctree' to be $(srctree))15endif16 17INSTALL = install18 19# Use DESTDIR for installing into a different root directory.20# This is useful for building a package. The program will be21# installed in this directory as if it was the root directory.22# Then the build tool can move it later.23DESTDIR ?=24DESTDIR_SQ = '$(subst ','\'',$(DESTDIR))'25 26include $(srctree)/tools/scripts/Makefile.include27include $(srctree)/tools/scripts/Makefile.arch28 29ifeq ($(LP64), 1)30  libdir_relative = lib6431else32  libdir_relative = lib33endif34 35prefix ?=36libdir = $(prefix)/$(libdir_relative)37 38# Shell quotes39libdir_SQ = $(subst ','\'',$(libdir))40libdir_relative_SQ = $(subst ','\'',$(libdir_relative))41 42ifeq ("$(origin V)", "command line")43  VERBOSE = $(V)44endif45ifndef VERBOSE46  VERBOSE = 047endif48 49ifeq ($(VERBOSE),1)50  Q =51else52  Q = @53endif54 55# Set compile option CFLAGS56ifdef EXTRA_CFLAGS57  CFLAGS := $(EXTRA_CFLAGS)58else59  CFLAGS := -g -Wall60endif61 62INCLUDES = \63-I/usr/include/libnl3 \64-I$(srctree)/tools/lib/thermal/include \65-I$(srctree)/tools/lib/ \66-I$(srctree)/tools/include \67-I$(srctree)/tools/arch/$(SRCARCH)/include/ \68-I$(srctree)/tools/arch/$(SRCARCH)/include/uapi \69-I$(srctree)/tools/include/uapi70 71# Append required CFLAGS72override CFLAGS += $(EXTRA_WARNINGS)73override CFLAGS += -Werror -Wall74override CFLAGS += -fPIC75override CFLAGS += $(INCLUDES)76override CFGLAS += -Wl,-L.77override CFGLAS += -Wl,-lthermal78 79all:80 81export srctree OUTPUT CC LD CFLAGS V82export DESTDIR DESTDIR_SQ83 84include $(srctree)/tools/build/Makefile.include85 86PATCHLEVEL    = $(LIBTHERMAL_TOOLS_PATCHLEVEL)87EXTRAVERSION  = $(LIBTHERMAL_TOOLS_EXTRAVERSION)88VERSION       = $(LIBTHERMAL_TOOLS_VERSION).$(LIBTHERMAL_TOOLS_PATCHLEVEL).$(LIBTHERMAL_TOOLS_EXTRAVERSION)89 90LIBTHERMAL_TOOLS_SO := $(OUTPUT)libthermal_tools.so.$(VERSION)91LIBTHERMAL_TOOLS_A  := $(OUTPUT)libthermal_tools.a92LIBTHERMAL_TOOLS_IN := $(OUTPUT)libthermal_tools-in.o93LIBTHERMAL_TOOLS_PC := $(OUTPUT)libthermal_tools.pc94 95LIBTHERMAL_TOOLS_ALL := $(LIBTHERMAL_TOOLS_A) $(OUTPUT)libthermal_tools.so*96 97$(LIBTHERMAL_TOOLS_IN): FORCE98	$(Q)$(MAKE) $(build)=libthermal_tools99 100$(LIBTHERMAL_TOOLS_A): $(LIBTHERMAL_TOOLS_IN)101	$(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(LIBTHERMAL_TOOLS_IN)102 103$(LIBTHERMAL_TOOLS_SO): $(LIBTHERMAL_TOOLS_IN)104	$(QUIET_LINK)$(CC) --shared -Wl,-soname,libthermal_tools.so $^ -o $@105	@ln -sf $(@F) $(OUTPUT)libthermal_tools.so106	@ln -sf $(@F) $(OUTPUT)libthermal_tools.so.$(LIBTHERMAL_TOOLS_VERSION)107 108 109libs: $(LIBTHERMAL_TOOLS_A) $(LIBTHERMAL_TOOLS_SO) $(LIBTHERMAL_TOOLS_PC)110 111all: fixdep112	$(Q)$(MAKE) libs113 114clean:115	$(call QUIET_CLEAN, libthermal_tools) $(RM) $(LIBTHERMAL_TOOLS_A) \116                *.o *~ *.a *.so *.so.$(VERSION) *.so.$(LIBTHERMAL_TOOLS_VERSION) .*.d .*.cmd LIBTHERMAL_TOOLS-CFLAGS $(LIBTHERMAL_TOOLS_PC)117 118$(LIBTHERMAL_TOOLS_PC):119	$(QUIET_GEN)sed -e "s|@PREFIX@|$(prefix)|" \120		-e "s|@LIBDIR@|$(libdir_SQ)|" \121		-e "s|@VERSION@|$(VERSION)|" \122		< libthermal_tools.pc.template > $@123 124define do_install_mkdir125	if [ ! -d '$(DESTDIR_SQ)$1' ]; then             \126		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$1'; \127	fi128endef129 130define do_install131	if [ ! -d '$(DESTDIR_SQ)$2' ]; then             \132		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$2'; \133	fi;                                             \134	$(INSTALL) $1 $(if $3,-m $3,) '$(DESTDIR_SQ)$2'135endef136 137install_lib: libs138	$(call QUIET_INSTALL, $(LIBTHERMAL_TOOLS_ALL)) \139		$(call do_install_mkdir,$(libdir_SQ)); \140		cp -fpR $(LIBTHERMAL_TOOLS_ALL) $(DESTDIR)$(libdir_SQ)141 142install_headers:143	$(call QUIET_INSTALL, headers) \144		$(call do_install,include/thermal.h,$(prefix)/include/thermal,644); \145 146install_pkgconfig: $(LIBTHERMAL_TOOLS_PC)147	$(call QUIET_INSTALL, $(LIBTHERMAL_TOOLS_PC)) \148		$(call do_install,$(LIBTHERMAL_TOOLS_PC),$(libdir_SQ)/pkgconfig,644)149 150install_doc:151	$(Q)$(MAKE) -C Documentation install-man install-html install-examples152 153#install: install_lib install_headers install_pkgconfig install_doc154install: install_lib install_headers install_pkgconfig155 156FORCE:157 158.PHONY: all install clean FORCE159