xref: /openbmc/linux/tools/power/acpi/Makefile.rules (revision 2359ccdd)
1# tools/power/acpi/Makefile.rules - ACPI tool Makefile
2#
3# Copyright (c) 2015, Intel Corporation
4#   Author: Lv Zheng <lv.zheng@intel.com>
5#
6# This program is free software; you can redistribute it and/or
7# modify it under the terms of the GNU General Public License
8# as published by the Free Software Foundation; version 2
9# of the License.
10
11objdir := $(OUTPUT)tools/$(TOOL)/
12toolobjs := $(addprefix $(objdir),$(TOOL_OBJS))
13$(OUTPUT)$(TOOL): $(toolobjs) FORCE
14	$(ECHO) "  LD      " $(subst $(OUTPUT),,$@)
15	$(QUIET) $(LD) $(CFLAGS) $(LDFLAGS) $(toolobjs) -L$(OUTPUT) -o $@
16	$(ECHO) "  STRIP   " $(subst $(OUTPUT),,$@)
17	$(QUIET) $(STRIPCMD) $@
18
19$(KERNEL_INCLUDE):
20	$(ECHO) "  MKDIR   " $(subst $(OUTPUT),,$@)
21	$(QUIET) mkdir -p $(KERNEL_INCLUDE)
22	$(ECHO) "  CP      " $(subst $(OUTPUT),,$@)
23	$(QUIET) cp -rf $(srctree)/../../../include/acpi $(KERNEL_INCLUDE)/
24
25$(objdir)%.o: %.c $(KERNEL_INCLUDE)
26	$(ECHO) "  CC      " $(subst $(OUTPUT),,$@)
27	$(QUIET) $(CC) -c $(CFLAGS) -o $@ $<
28
29all: $(OUTPUT)$(TOOL)
30clean:
31	$(ECHO) "  RMOBJ   " $(subst $(OUTPUT),,$(objdir))
32	$(QUIET) find $(objdir) \( -not -type d \)\
33		 -and \( -name '*~' -o -name '*.[oas]' \)\
34		 -type f -print | xargs rm -f
35	$(ECHO) "  RM      " $(TOOL)
36	$(QUIET) rm -f $(OUTPUT)$(TOOL)
37	$(ECHO) "  RMINC   " $(subst $(OUTPUT),,$(KERNEL_INCLUDE))
38	$(QUIET) rm -rf $(KERNEL_INCLUDE)
39
40install-tools:
41	$(ECHO) "  INST    " $(TOOL)
42	$(QUIET) $(INSTALL) -d $(DESTDIR)$(sbindir)
43	$(QUIET) $(INSTALL_PROGRAM) $(OUTPUT)$(TOOL) $(DESTDIR)$(sbindir)
44uninstall-tools:
45	$(ECHO) "  UNINST  " $(TOOL)
46	$(QUIET) rm -f $(DESTDIR)$(sbindir)/$(TOOL)
47
48install: all install-tools $(EXTRA_INSTALL)
49uninstall: uninstall-tools $(EXTRA_UNINSTALL)
50
51.PHONY: FORCE
52