Makefile 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. #
  2. # Copyright (C) 1999-2007 Hewlett-Packard Co.
  3. # Contributed by David Mosberger <davidm@hpl.hp.com>
  4. # Contributed by Stephane Eranian <eranian@hpl.hp.com>
  5. #
  6. # All rights reserved.
  7. #
  8. # Redistribution and use in source and binary forms, with or without
  9. # modification, are permitted provided that the following conditions
  10. # are met:
  11. #
  12. # * Redistributions of source code must retain the above copyright
  13. # notice, this list of conditions and the following disclaimer.
  14. # * Redistributions in binary form must reproduce the above
  15. # copyright notice, this list of conditions and the following
  16. # disclaimer in the documentation and/or other materials
  17. # provided with the distribution.
  18. # * Neither the name of Hewlett-Packard Co. nor the names of its
  19. # contributors may be used to endorse or promote products derived
  20. # from this software without specific prior written permission.
  21. #
  22. # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
  23. # CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
  24. # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  25. # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  26. # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
  27. # BE LIABLE FOR ANYDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
  28. # OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  29. # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  30. # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  31. # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
  32. # TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
  33. # THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  34. # SUCH DAMAGE.
  35. #
  36. include env.mk
  37. export VERSION = 3.0.17
  38. MKFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
  39. SRCDIR = $(dir $(MKFILE_PATH))
  40. VPATH = $(SRCDIR)
  41. include $(SRCDIR)/Make.defaults
  42. SUBDIRS = lib gnuefi inc apps
  43. all: check_gcc $(SUBDIRS)
  44. ifeq ($(ARCH), riscv64)
  45. @mkdir -p output
  46. cp riscv64/apps/dragon_stub.efi ./output/dragon_stub-riscv64.efi
  47. endif
  48. .PHONY:
  49. run:
  50. @$(MAKE) all -j $(shell nproc)
  51. @$(MAKE) qemu
  52. qemu:
  53. cd tools && ./run-qemu.sh && cd ..
  54. gnuefi: lib
  55. apps: gnuefi
  56. mkvars:
  57. @echo AR=$(AR)
  58. @echo ARCH=$(ARCH)
  59. @echo ARCH3264=$(ARCH3264)
  60. @echo AS=$(AS)
  61. @echo ASFLAGS=$(ASFLAGS)
  62. @echo CC=$(CC)
  63. @echo CFLAGS=$(CFLAGS)
  64. @echo CPPFLAGS=$(CPPFLAGS)
  65. @echo GCCMINOR=$(GCCMINOR)
  66. @echo GCCNEWENOUGH=$(GCCNEWENOUGH)
  67. @echo GCCVERSION=$(GCCVERSION)
  68. @echo HOSTARCH=$(HOSTARCH)
  69. @echo INCDIR=$(INCDIR)
  70. @echo INSTALL=$(INSTALL)
  71. @echo INSTALLROOT=$(INSTALLROOT)
  72. @echo LD=$(LD)
  73. @echo LDFLAGS=$(LDFLAGS)
  74. @echo LIBDIR=$(LIBDIR)
  75. @echo OBJCOPY=$(OBJCOPY)
  76. @echo OS=$(OS)
  77. @echo prefix=$(prefix)
  78. @echo PREFIX=$(PREFIX)
  79. @echo RANLIB=$(RANLIB)
  80. @echo SRCDIR=$(SRCDIR)
  81. @echo TOPDIR=$(TOPDIR)
  82. $(SUBDIRS):
  83. mkdir -p $(OBJDIR)/$@
  84. $(MAKE) -C $(OBJDIR)/$@ -f $(SRCDIR)/$@/Makefile SRCDIR=$(SRCDIR)/$@ ARCH=$(ARCH)
  85. clean:
  86. rm -f *~
  87. @set -e ; for d in $(SUBDIRS); do \
  88. if [ -d $(OBJDIR)/$$d ]; then \
  89. $(MAKE) -C $(OBJDIR)/$$d -f $(SRCDIR)/$$d/Makefile SRCDIR=$(SRCDIR)/$$d clean; \
  90. fi; \
  91. done
  92. install:
  93. @set -e ; for d in $(SUBDIRS); do \
  94. mkdir -p $(OBJDIR)/$$d; \
  95. $(MAKE) -C $(OBJDIR)/$$d -f $(SRCDIR)/$$d/Makefile SRCDIR=$(SRCDIR)/$$d install; done
  96. .PHONY: $(SUBDIRS) clean depend
  97. #
  98. # on both platforms you must use gcc 3.0 or higher
  99. #
  100. check_gcc:
  101. ifeq ($(GCC_VERSION),2)
  102. @echo "you need to use a version of gcc >= 3.0, you are using `$(CC) --version`"
  103. @exit 1
  104. endif
  105. include $(SRCDIR)/Make.rules
  106. test-archive:
  107. @rm -rf /tmp/gnu-efi-$(VERSION) /tmp/gnu-efi-$(VERSION)-tmp
  108. @mkdir -p /tmp/gnu-efi-$(VERSION)-tmp
  109. @git archive --format=tar $(shell git branch | awk '/^*/ { print $$2 }') | ( cd /tmp/gnu-efi-$(VERSION)-tmp/ ; tar x )
  110. @git diff | ( cd /tmp/gnu-efi-$(VERSION)-tmp/ ; patch -s -p1 -b -z .gitdiff )
  111. @mv /tmp/gnu-efi-$(VERSION)-tmp/ /tmp/gnu-efi-$(VERSION)/
  112. @dir=$$PWD; cd /tmp; tar -c --bzip2 -f $$dir/gnu-efi-$(VERSION).tar.bz2 gnu-efi-$(VERSION)
  113. @rm -rf /tmp/gnu-efi-$(VERSION)
  114. @echo "The archive is in gnu-efi-$(VERSION).tar.bz2"
  115. tag:
  116. git tag $(VERSION) refs/heads/master
  117. archive: tag
  118. @rm -rf /tmp/gnu-efi-$(VERSION) /tmp/gnu-efi-$(VERSION)-tmp
  119. @mkdir -p /tmp/gnu-efi-$(VERSION)-tmp
  120. @git archive --format=tar $(VERSION) | ( cd /tmp/gnu-efi-$(VERSION)-tmp/ ; tar x )
  121. @mv /tmp/gnu-efi-$(VERSION)-tmp/ /tmp/gnu-efi-$(VERSION)/
  122. @dir=$$PWD; cd /tmp; tar -c --bzip2 -f $$dir/gnu-efi-$(VERSION).tar.bz2 gnu-efi-$(VERSION)
  123. @rm -rf /tmp/gnu-efi-$(VERSION)
  124. @echo "The archive is in gnu-efi-$(VERSION).tar.bz2"