make.rules 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. #
  2. # The contents of this file are subject to the Mozilla Public
  3. # License Version 1.1 (the "License"); you may not use this file
  4. # except in compliance with the License. You may obtain a copy of
  5. # the License at http://www.mozilla.org/MPL/
  6. # Alternatively, the contents of this file may be used under the
  7. # terms of the GNU General Public License Version 2 or later (the
  8. # "GPL"), in which case the provisions of the GPL are applicable
  9. # instead of those above. You may obtain a copy of the Licence at
  10. # http://www.gnu.org/copyleft/gpl.html
  11. #
  12. # This program is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. # Relevant for more details.
  16. #
  17. # This file was created by members of the firebird development team.
  18. # All individual contributions remain the Copyright (C) of those
  19. # individuals. Contributors to this file are either listed here or
  20. # can be obtained from a CVS history command.
  21. #
  22. # All rights reserved.
  23. #
  24. # Created by: Mark O'Donohue <[email protected]>
  25. #
  26. # Contributor(s):
  27. #
  28. #
  29. #
  30. #____________________________________________________________________________
  31. # Please don't use compiler/platform specific flags here - nmcc 02-Nov-2002
  32. WFLAGS =-I$(SRC_ROOT)/include/gen -I$(SRC_ROOT)/include $(CPPFLAGS) $(LTCSOURCE)
  33. ifneq ($(SYSTEM_BOOST_FLG),Y)
  34. WFLAGS += -I$(ROOT)/extern/boost
  35. endif
  36. WFLAGS += -I$(LIBCDS_INC) -D$(LIBCDS_DEF)
  37. ifeq ($(TOMMATH_BUILD_FLG),Y)
  38. WFLAGS += -I$(TOMMATH_INC)
  39. endif
  40. ifeq ($(TOMCRYPT_BUILD_FLG),Y)
  41. WFLAGS += -I$(TOMCRYPT_INC)
  42. endif
  43. ifeq ($(RE2_BUILD_FLG),Y)
  44. WFLAGS += -I$(ROOT)/extern/re2
  45. endif
  46. ifeq ($(ABSEIL_BUILD_FLG),Y)
  47. WFLAGS += -I$(ROOT)/extern/int128
  48. endif
  49. ifeq ($(LSB_FLG),Y)
  50. WFLAGS += -DLSB_BUILD
  51. endif
  52. ifeq ($(TARGET),Release)
  53. WFLAGS += $(PROD_FLAGS)
  54. else
  55. WFLAGS += $(DEV_FLAGS) -DDEV_BUILD
  56. endif
  57. WCFLAGS = $(WFLAGS) $(CFLAGS) $(AC_CFLAGS) $(GLOB_OPTIONS)
  58. WCXXFLAGS = $(WFLAGS) $(PLUSPLUS_FLAGS) $(PLATFORM_PLUSPLUS_FLAGS) $(CXXFLAGS) $(AC_CXXFLAGS) $(GLOB_OPTIONS)
  59. WLDFLAGS = $(LDFLAGS) $(AC_LDFLAGS)
  60. ifneq ($(PLATFORM),DARWIN)
  61. PLATFORM_LDFLAGS="-static-libstdc++"
  62. WLDFLAGS += $(PLATFORM_LDFLAGS)
  63. endif
  64. # Here we have definitions for using the preprocessor.
  65. # The GPRE_FLAGS is overwritten in Makefile.in.jrd Makefile.in.gpre and
  66. # since they do something extra to allow the boot build to work.
  67. #
  68. # One other point is that sometimes a failure in compile with gpre does not
  69. # result in an error being generated. The generated source file still
  70. # compiles and throws the make off the path.
  71. #
  72. # This bit of code is part of unfinished bit to let make determine if
  73. # gpre gpre_static or gpre_boot should be used based on which ones exist.
  74. #
  75. # testgpre = $(shell if [ -f $(GPRE) ]; then; echo $(GPRE); else; echo ""; fi)
  76. #test1:
  77. # $(ECHO) $(testgpre)
  78. GPRE_FLAGS= -m -z -n
  79. JRD_GPRE_FLAGS = -n -z -gds_cxx -ids
  80. OBJECT_GPRE_FLAGS = -m -z -n -ocxx
  81. .SUFFIXES: .c .e .epp .cpp
  82. .e.c:
  83. $(GPRE_CURRENT) $(GPRE_FLAGS) $< $@
  84. $(OBJ)/jrd/%.cpp: $(SRC_ROOT)/jrd/%.epp
  85. $(GPRE_CURRENT) $(JRD_GPRE_FLAGS) $(firstword $<) $@
  86. $(OBJ)/isql/%.cpp: $(SRC_ROOT)/isql/%.epp
  87. $(GPRE_CURRENT) $(OBJECT_GPRE_FLAGS) $< $@
  88. $(OBJ)/burp/%.cpp: $(SRC_ROOT)/burp/%.epp
  89. $(GPRE_CURRENT) $(OBJECT_GPRE_FLAGS) $< $@
  90. $(OBJ)/%.cpp: $(SRC_ROOT)/%.epp
  91. $(GPRE_CURRENT) $(GPRE_FLAGS) $(firstword $<) $@
  92. .SUFFIXES: .lo .o .cpp .c .cc
  93. %.o: %.c
  94. $(CC) $(WCFLAGS) -c $(firstword $<) -o $@
  95. %.o: %.cc
  96. $(CXX) $(WCFLAGS) -c $(firstword $<) -o $@
  97. $(OBJ)/%.o: $(SRC_ROOT)/%.c
  98. $(CC) $(WCFLAGS) -c $(firstword $<) -o $@
  99. @sed $(INLINE_EDIT_SED) -e "1,2s/:/: \$$(wildcard/" -e "\$$s/\(.*\)/\\1)/" $(patsubst %.o,%.d,$@)
  100. $(OBJ)/%.o: $(SRC_ROOT)/%.m
  101. $(CC) $(WCFLAGS) -c $(firstword $<) -o $@
  102. @sed $(INLINE_EDIT_SED) -e "1,2s/:/: \$$(wildcard/" -e "\$$s/\(.*\)/\\1)/" $(patsubst %.o,%.d,$@)
  103. $(OBJ)/%.o: $(OBJ)/%.cpp
  104. $(CXX) $(WCXXFLAGS) -c $(firstword $<) -o $@
  105. @sed $(INLINE_EDIT_SED) -e "1,2s/:/: \$$(wildcard/" -e "\$$s/\(.*\)/\\1)/" $(patsubst %.o,%.d,$@)
  106. $(OBJ)/%.o: $(SRC_ROOT)/%.cpp
  107. $(CXX) $(WCXXFLAGS) -c $(firstword $<) -o $@
  108. @sed $(INLINE_EDIT_SED) -e "1,2s/:/: \$$(wildcard/" -e "\$$s/\(.*\)/\\1)/" $(patsubst %.o,%.d,$@)
  109. $(OBJ)/%.o: $(ROOT)/%.cpp
  110. $(CXX) $(WCFLAGS) -c $(firstword $<) -o $@
  111. @sed $(INLINE_EDIT_SED) -e "1,2s/:/: \$$(wildcard/" -e "\$$s/\(.*\)/\\1)/" $(patsubst %.o,%.d,$@)
  112. .SUFFIXES: .epp .e
  113. # Rules for making resource files
  114. $(GEN_ROOT)/%.res: $(SRC_ROOT)/%.rc
  115. windres --output-format=coff --include-dir=$(<D) $< $@
  116. # Rule for making gbak files when cross-compiling
  117. .SUFFIXES: .gbak .fdb
  118. $(GEN_ROOT)/$(TARGET)/%.gbak: $(GEN_ROOT)/Native/%.fdb
  119. $(RUN_GBAK) -b $(firstword $<) $(firstword $@)
  120. $(GEN_ROOT)/%.gbak: $(GEN_ROOT)/%.fdb
  121. $(RUN_GBAK) -b $(firstword $<) $(firstword $@)