Makefile.am 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. # Makefile for gotools
  2. # Copyright 2015 Free Software Foundation, Inc.
  3. #
  4. # This file is free software; you can redistribute it and/or modify
  5. # it under the terms of the GNU General Public License as published by
  6. # the Free Software Foundation; either version 3 of the License, or
  7. # (at your option) any later version.
  8. #
  9. # This program is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. # GNU General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU General Public License
  15. # along with this program; see the file COPYING3. If not see
  16. # <http://www.gnu.org/licenses/>.
  17. ACLOCAL_AMFLAGS = -I ./config -I ../config
  18. gcc_version := $(shell $(GCC_FOR_TARGET) -dumpversion)
  19. libexecsubdir = $(libexecdir)/gcc/$(target_noncanonical)/$(gcc_version)
  20. mkinstalldirs = $(SHELL) $(toplevel_srcdir)/mkinstalldirs
  21. PWD_COMMAND = $${PWDCMD-pwd}
  22. STAMP = echo timestamp >
  23. libgodir = ../$(target_noncanonical)/libgo
  24. LIBGODEP = $(libgodir)/libgo.la
  25. if NATIVE
  26. # Use the compiler we just built.
  27. GOCOMPILER = $(GOC_FOR_TARGET)
  28. else
  29. GOCOMPILER = $(GOC)
  30. endif
  31. GOCFLAGS = $(CFLAGS_FOR_TARGET)
  32. GOCOMPILE = $(GOCOMPILER) $(GOCFLAGS)
  33. AM_LDFLAGS = -L $(libgodir) -L $(libgodir)/.libs
  34. GOLINK = $(GOCOMPILER) $(GOCFLAGS) $(AM_GOCFLAGS) $(LDFLAGS) $(AM_LDFLAGS) -o $@
  35. cmdsrcdir = $(srcdir)/../libgo/go/cmd
  36. go_cmd_go_files = \
  37. $(cmdsrcdir)/go/build.go \
  38. $(cmdsrcdir)/go/clean.go \
  39. $(cmdsrcdir)/go/context.go \
  40. $(cmdsrcdir)/go/discovery.go \
  41. $(cmdsrcdir)/go/env.go \
  42. $(cmdsrcdir)/go/fix.go \
  43. $(cmdsrcdir)/go/fmt.go \
  44. $(cmdsrcdir)/go/generate.go \
  45. $(cmdsrcdir)/go/get.go \
  46. $(cmdsrcdir)/go/go11.go \
  47. $(cmdsrcdir)/go/help.go \
  48. $(cmdsrcdir)/go/http.go \
  49. $(cmdsrcdir)/go/list.go \
  50. $(cmdsrcdir)/go/main.go \
  51. $(cmdsrcdir)/go/pkg.go \
  52. $(cmdsrcdir)/go/run.go \
  53. $(cmdsrcdir)/go/signal.go \
  54. $(cmdsrcdir)/go/signal_unix.go \
  55. $(cmdsrcdir)/go/test.go \
  56. $(cmdsrcdir)/go/testflag.go \
  57. $(cmdsrcdir)/go/tool.go \
  58. $(cmdsrcdir)/go/vcs.go \
  59. $(cmdsrcdir)/go/version.go \
  60. $(cmdsrcdir)/go/vet.go \
  61. $(libgodir)/zstdpkglist.go
  62. go_cmd_gofmt_files = \
  63. $(cmdsrcdir)/gofmt/doc.go \
  64. $(cmdsrcdir)/gofmt/gofmt.go \
  65. $(cmdsrcdir)/gofmt/rewrite.go \
  66. $(cmdsrcdir)/gofmt/simplify.go
  67. go_cmd_cgo_files = \
  68. $(cmdsrcdir)/cgo/ast.go \
  69. $(cmdsrcdir)/cgo/doc.go \
  70. $(cmdsrcdir)/cgo/gcc.go \
  71. $(cmdsrcdir)/cgo/godefs.go \
  72. $(cmdsrcdir)/cgo/main.go \
  73. $(cmdsrcdir)/cgo/out.go \
  74. $(cmdsrcdir)/cgo/util.go
  75. GCCGO_INSTALL_NAME := $(shell echo gccgo|sed '$(program_transform_name)')
  76. GCC_INSTALL_NAME := $(shell echo gcc|sed '$(program_transform_name)')
  77. GXX_INSTALL_NAME := $(shell echo g++|sed '$(program_transform_name)')
  78. zdefaultcc.go: s-zdefaultcc; @true
  79. s-zdefaultcc: Makefile
  80. echo 'package main' > zdefaultcc.go.tmp
  81. echo 'const defaultGCCGO = "$(bindir)/$(GCCGO_INSTALL_NAME)"' >> zdefaultcc.go.tmp
  82. echo 'const defaultCC = "$(bindir)/$(GCC_INSTALL_NAME)"' >> zdefaultcc.go.tmp
  83. echo 'const defaultCXX = "$(bindir)/$(GXX_INSTALL_NAME)"' >> zdefaultcc.go.tmp
  84. $(SHELL) $(srcdir)/../move-if-change zdefaultcc.go.tmp zdefaultcc.go
  85. $(STAMP) $@
  86. MOSTLYCLEANFILES = zdefaultcc.go s-zdefaultcc
  87. if NATIVE
  88. # For a native build we build the programs using the newly built libgo
  89. # and install them as regular programs.
  90. bin_PROGRAMS = go$(EXEEXT) gofmt$(EXEEXT)
  91. noinst_PROGRAMS = cgo$(EXEEXT)
  92. man_MANS = go.1 gofmt.1
  93. go$(EXEEXT): $(go_cmd_go_files) zdefaultcc.go $(LIBGODEP)
  94. $(GOLINK) $(go_cmd_go_files) zdefaultcc.go $(LIBS) $(NET_LIBS)
  95. gofmt$(EXEEXT): $(go_cmd_gofmt_files) $(LIBGODEP)
  96. $(GOLINK) $(go_cmd_gofmt_files) $(LIBS) $(NET_LIBS)
  97. cgo$(EXEEXT): $(go_cmd_cgo_files) zdefaultcc.go $(LIBGODEP)
  98. $(GOLINK) $(go_cmd_cgo_files) zdefaultcc.go $(LIBS) $(NET_LIBS)
  99. install-exec-local: cgo$(EXEEXT)
  100. $(MKDIR_P) $(DESTDIR)$(libexecsubdir)
  101. rm -f $(DESTDIR)$(libexecsubdir)/cgo$(exeext)
  102. $(INSTALL_PROGRAM) cgo$(exeext) $(DESTDIR)$(libexecsubdir)/cgo$(exeext)
  103. uninstall-local:
  104. rm -f $(DESTDIR)$(libexecsubdir)/cgo$(exeext)
  105. else
  106. # For a non-native build we have to build the programs using a
  107. # previously built host (or build -> host) Go compiler. We should
  108. # only do this if such a compiler is available. We also need to get
  109. # the right values for GOARCH and GOOS in the default build context in
  110. # the go/build package. Figure this out later.
  111. endif