Makefile 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. # tools/power/acpi/Makefile - ACPI tool Makefile
  2. #
  3. # Copyright (c) 2013, 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. OUTPUT=./
  11. ifeq ("$(origin O)", "command line")
  12. OUTPUT := $(O)/
  13. endif
  14. ifneq ($(OUTPUT),)
  15. # check that the output directory actually exists
  16. OUTDIR := $(shell cd $(OUTPUT) && /bin/pwd)
  17. $(if $(OUTDIR),, $(error output directory "$(OUTPUT)" does not exist))
  18. endif
  19. SUBDIRS = tools/ec
  20. # --- CONFIGURATION BEGIN ---
  21. # Set the following to `true' to make a unstripped, unoptimized
  22. # binary. Leave this set to `false' for production use.
  23. DEBUG ?= true
  24. # make the build silent. Set this to something else to make it noisy again.
  25. V ?= false
  26. # Prefix to the directories we're installing to
  27. DESTDIR ?=
  28. # --- CONFIGURATION END ---
  29. # Directory definitions. These are default and most probably
  30. # do not need to be changed. Please note that DESTDIR is
  31. # added in front of any of them
  32. bindir ?= /usr/bin
  33. sbindir ?= /usr/sbin
  34. mandir ?= /usr/man
  35. # Toolchain: what tools do we use, and what options do they need:
  36. INSTALL = /usr/bin/install -c
  37. INSTALL_PROGRAM = ${INSTALL}
  38. INSTALL_DATA = ${INSTALL} -m 644
  39. INSTALL_SCRIPT = ${INSTALL_PROGRAM}
  40. # If you are running a cross compiler, you may want to set this
  41. # to something more interesting, like "arm-linux-". If you want
  42. # to compile vs uClibc, that can be done here as well.
  43. CROSS = #/usr/i386-linux-uclibc/usr/bin/i386-uclibc-
  44. CC = $(CROSS)gcc
  45. LD = $(CROSS)gcc
  46. STRIP = $(CROSS)strip
  47. HOSTCC = gcc
  48. # check if compiler option is supported
  49. cc-supports = ${shell if $(CC) ${1} -S -o /dev/null -x c /dev/null > /dev/null 2>&1; then echo "$(1)"; fi;}
  50. # use '-Os' optimization if available, else use -O2
  51. OPTIMIZATION := $(call cc-supports,-Os,-O2)
  52. WARNINGS := -Wall
  53. WARNINGS += $(call cc-supports,-Wstrict-prototypes)
  54. WARNINGS += $(call cc-supports,-Wdeclaration-after-statement)
  55. KERNEL_INCLUDE := ../../../include
  56. ACPICA_INCLUDE := ../../../drivers/acpi/acpica
  57. CFLAGS += -D_LINUX -I$(KERNEL_INCLUDE) -I$(ACPICA_INCLUDE)
  58. CFLAGS += $(WARNINGS)
  59. ifeq ($(strip $(V)),false)
  60. QUIET=@
  61. ECHO=@echo
  62. else
  63. QUIET=
  64. ECHO=@\#
  65. endif
  66. export QUIET ECHO
  67. # if DEBUG is enabled, then we do not strip or optimize
  68. ifeq ($(strip $(DEBUG)),true)
  69. CFLAGS += -O1 -g -DDEBUG
  70. STRIPCMD = /bin/true -Since_we_are_debugging
  71. else
  72. CFLAGS += $(OPTIMIZATION) -fomit-frame-pointer
  73. STRIPCMD = $(STRIP) -s --remove-section=.note --remove-section=.comment
  74. endif
  75. # --- ACPIDUMP BEGIN ---
  76. vpath %.c \
  77. ../../../drivers/acpi/acpica\
  78. tools/acpidump\
  79. common\
  80. os_specific/service_layers
  81. CFLAGS += -DACPI_DUMP_APP -Itools/acpidump
  82. DUMP_OBJS = \
  83. apdump.o\
  84. apfiles.o\
  85. apmain.o\
  86. osunixdir.o\
  87. osunixmap.o\
  88. osunixxf.o\
  89. tbprint.o\
  90. tbxfroot.o\
  91. utbuffer.o\
  92. utdebug.o\
  93. utexcep.o\
  94. utglobal.o\
  95. utmath.o\
  96. utprint.o\
  97. utstring.o\
  98. utxferror.o\
  99. oslibcfs.o\
  100. oslinuxtbl.o\
  101. cmfsize.o\
  102. getopt.o
  103. DUMP_OBJS := $(addprefix $(OUTPUT)tools/acpidump/,$(DUMP_OBJS))
  104. $(OUTPUT)acpidump: $(DUMP_OBJS)
  105. $(ECHO) " LD " $@
  106. $(QUIET) $(LD) $(CFLAGS) $(LDFLAGS) $(DUMP_OBJS) -L$(OUTPUT) -o $@
  107. $(QUIET) $(STRIPCMD) $@
  108. $(OUTPUT)tools/acpidump/%.o: %.c
  109. $(ECHO) " CC " $@
  110. $(QUIET) $(CC) -c $(CFLAGS) -o $@ $<
  111. # --- ACPIDUMP END ---
  112. all: $(OUTPUT)acpidump
  113. echo $(OUTPUT)
  114. clean:
  115. -find $(OUTPUT) \( -not -type d \) -and \( -name '*~' -o -name '*.[oas]' \) -type f -print \
  116. | xargs rm -f
  117. -rm -f $(OUTPUT)acpidump
  118. install-tools:
  119. $(INSTALL) -d $(DESTDIR)${sbindir}
  120. $(INSTALL_PROGRAM) $(OUTPUT)acpidump $(DESTDIR)${sbindir}
  121. install-man:
  122. $(INSTALL_DATA) -D man/acpidump.8 $(DESTDIR)${mandir}/man8/acpidump.8
  123. install: all install-tools install-man
  124. uninstall:
  125. - rm -f $(DESTDIR)${sbindir}/acpidump
  126. - rm -f $(DESTDIR)${mandir}/man8/acpidump.8
  127. .PHONY: all utils install-tools install-man install uninstall clean