162306a36Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0-only
262306a36Sopenharmony_ci# tools/power/acpi/Makefile.rules - ACPI tool Makefile
362306a36Sopenharmony_ci#
462306a36Sopenharmony_ci# Copyright (c) 2015, Intel Corporation
562306a36Sopenharmony_ci#   Author: Lv Zheng <lv.zheng@intel.com>
662306a36Sopenharmony_ci#
762306a36Sopenharmony_ci
862306a36Sopenharmony_ciobjdir := $(OUTPUT)tools/$(TOOL)/
962306a36Sopenharmony_citoolobjs := $(addprefix $(objdir),$(TOOL_OBJS))
1062306a36Sopenharmony_ci$(OUTPUT)$(TOOL): $(toolobjs) FORCE
1162306a36Sopenharmony_ci	$(ECHO) "  LD      " $(subst $(OUTPUT),,$@)
1262306a36Sopenharmony_ci	$(QUIET) $(LD) $(CFLAGS) $(toolobjs) $(LDFLAGS) -L$(OUTPUT) -o $@
1362306a36Sopenharmony_ci	$(ECHO) "  STRIP   " $(subst $(OUTPUT),,$@)
1462306a36Sopenharmony_ci	$(QUIET) $(STRIPCMD) $@
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ci$(KERNEL_INCLUDE):
1762306a36Sopenharmony_ci	$(ECHO) "  MKDIR   " $(subst $(OUTPUT),,$@)
1862306a36Sopenharmony_ci	$(QUIET) mkdir -p $(KERNEL_INCLUDE)
1962306a36Sopenharmony_ci	$(ECHO) "  CP      " $(subst $(OUTPUT),,$@)
2062306a36Sopenharmony_ci	$(QUIET) cp -rf $(srctree)/../../../include/acpi $(KERNEL_INCLUDE)/
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_ci$(objdir)%.o: %.c $(KERNEL_INCLUDE)
2362306a36Sopenharmony_ci	$(ECHO) "  CC      " $(subst $(OUTPUT),,$@)
2462306a36Sopenharmony_ci	$(QUIET) $(MKDIR) -p $(objdir) 2>/dev/null
2562306a36Sopenharmony_ci	$(QUIET) $(CC) -c $(CFLAGS) -o $@ $<
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_ciall: $(OUTPUT)$(TOOL)
2862306a36Sopenharmony_ciclean:
2962306a36Sopenharmony_ci	$(ECHO) "  RMOBJ   " $(subst $(OUTPUT),,$(objdir))
3062306a36Sopenharmony_ci	$(QUIET) find $(objdir) \( -not -type d \)\
3162306a36Sopenharmony_ci		 -and \( -name '*~' -o -name '*.[oas]' \)\
3262306a36Sopenharmony_ci		 -type f -print | xargs rm -f
3362306a36Sopenharmony_ci	$(ECHO) "  RM      " $(TOOL)
3462306a36Sopenharmony_ci	$(QUIET) rm -f $(OUTPUT)$(TOOL)
3562306a36Sopenharmony_ci	$(ECHO) "  RMINC   " $(subst $(OUTPUT),,$(KERNEL_INCLUDE))
3662306a36Sopenharmony_ci	$(QUIET) rm -rf $(KERNEL_INCLUDE)
3762306a36Sopenharmony_ci
3862306a36Sopenharmony_ciinstall-tools:
3962306a36Sopenharmony_ci	$(ECHO) "  INST    " $(TOOL)
4062306a36Sopenharmony_ci	$(QUIET) $(INSTALL) -d $(DESTDIR)$(sbindir)
4162306a36Sopenharmony_ci	$(QUIET) $(INSTALL_PROGRAM) $(OUTPUT)$(TOOL) $(DESTDIR)$(sbindir)
4262306a36Sopenharmony_ciuninstall-tools:
4362306a36Sopenharmony_ci	$(ECHO) "  UNINST  " $(TOOL)
4462306a36Sopenharmony_ci	$(QUIET) rm -f $(DESTDIR)$(sbindir)/$(TOOL)
4562306a36Sopenharmony_ci
4662306a36Sopenharmony_ciinstall: all install-tools $(EXTRA_INSTALL)
4762306a36Sopenharmony_ciuninstall: uninstall-tools $(EXTRA_UNINSTALL)
4862306a36Sopenharmony_ci
4962306a36Sopenharmony_ci.PHONY: FORCE
50