GNUmakefile 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. # Build Emacs from a fresh tarball or version-control checkout.
  2. # Copyright (C) 2011-2012 Free Software Foundation, Inc.
  3. #
  4. # This file is part of GNU Emacs.
  5. #
  6. # GNU Emacs is free software: you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation, either version 3 of the License, or
  9. # (at your option) any later version.
  10. #
  11. # GNU Emacs is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
  18. #
  19. # written by Paul Eggert
  20. # This GNUmakefile is for GNU Make. It is for convenience, so that
  21. # one can run 'make' in an unconfigured source tree. In such a tree,
  22. # this file causes GNU Make to first create a standard configuration
  23. # with the default options, and then reinvokes itself on the
  24. # newly-built Makefile. If the source tree is already configured,
  25. # this file defers to the existing Makefile.
  26. # If you are using a non-GNU 'make', or if you want non-default build
  27. # options, or if you want to build in an out-of-source tree, please
  28. # run "configure" by hand. But run autogen.sh first, if the source
  29. # was checked out directly from the repository.
  30. # If a Makefile already exists, just use it.
  31. ifeq ($(wildcard Makefile),Makefile)
  32. include Makefile
  33. else
  34. # If cleaning and Makefile does not exist, don't bother creating it.
  35. # The source tree is already clean, or is in a weird state that
  36. # requires expert attention.
  37. ifeq ($(filter-out %clean,$(or $(MAKECMDGOALS),default)),)
  38. $(MAKECMDGOALS):
  39. @echo >&2 'No Makefile; skipping $@.'
  40. else
  41. # No Makefile, and not cleaning.
  42. # If 'configure' does not exist, Emacs must have been checked
  43. # out directly from the repository; run ./autogen.sh.
  44. # Once 'configure' exists, run it.
  45. # Finally, run the actual 'make'.
  46. default $(filter-out configure Makefile,$(MAKECMDGOALS)): Makefile
  47. $(MAKE) -f Makefile $(MAKECMDGOALS)
  48. # Execute in sequence, so that multiple user goals don't conflict.
  49. .NOTPARALLEL:
  50. configure:
  51. @echo >&2 'There seems to be no "configure" file in this directory.'
  52. @echo >&2 'Running ./autogen.sh || autogen/copy_autogen ...'
  53. ./autogen.sh || autogen/copy_autogen
  54. @echo >&2 '"configure" file built.'
  55. Makefile: configure
  56. @echo >&2 'There seems to be no Makefile in this directory.'
  57. @echo >&2 'Running ./configure ...'
  58. ./configure
  59. @echo >&2 'Makefile built.'
  60. endif
  61. endif