make.rules 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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 -I$(ROOT)/extern/re2 $(CPPFLAGS) $(LTCSOURCE)
  33. ifeq ($(TOMMATH_BUILD_FLG),Y)
  34. WFLAGS += -I$(TOMMATH_INC)
  35. endif
  36. ifeq ($(TOMCRYPT_BUILD_FLG),Y)
  37. WFLAGS += -I$(TOMCRYPT_INC)
  38. endif
  39. ifeq ($(LSB_FLG),Y)
  40. WFLAGS += -DLSB_BUILD
  41. endif
  42. ifeq ($(TARGET),Release)
  43. WFLAGS += $(PROD_FLAGS)
  44. else
  45. WFLAGS += $(DEV_FLAGS) -DDEV_BUILD
  46. endif
  47. WCFLAGS = $(WFLAGS) $(CFLAGS) $(AC_CFLAGS) $(GLOB_OPTIONS)
  48. WCXXFLAGS = $(WFLAGS) $(PLUSPLUS_FLAGS) $(PLATFORM_PLUSPLUS_FLAGS) $(CXXFLAGS) $(AC_CXXFLAGS) $(GLOB_OPTIONS)
  49. # Here we have definitions for using the preprocessor.
  50. # The GPRE_FLAGS is overwritten in Makefile.in.jrd Makefile.in.gpre and
  51. # since they do something extra to allow the boot build to work.
  52. #
  53. # One other point is that sometimes a failure in compile with gpre does not
  54. # result in an error being generated. The generated source file still
  55. # compiles and throws the make off the path.
  56. #
  57. # This bit of code is part of unfinished bit to let make determine if
  58. # gpre gpre_static or gpre_boot should be used based on which ones exist.
  59. #
  60. # testgpre = $(shell if [ -f $(GPRE) ]; then; echo $(GPRE); else; echo ""; fi)
  61. #test1:
  62. # $(ECHO) $(testgpre)
  63. GPRE_FLAGS= -m -z -n
  64. JRD_GPRE_FLAGS = -n -z -gds_cxx -ids
  65. OBJECT_GPRE_FLAGS = -m -z -n -ocxx
  66. .SUFFIXES: .c .e .epp .cpp
  67. .e.c:
  68. $(GPRE_CURRENT) $(GPRE_FLAGS) $< $@
  69. $(OBJ)/jrd/%.cpp: $(SRC_ROOT)/jrd/%.epp
  70. $(GPRE_CURRENT) $(JRD_GPRE_FLAGS) $(firstword $<) $@
  71. $(OBJ)/isql/%.cpp: $(SRC_ROOT)/isql/%.epp
  72. $(GPRE_CURRENT) $(OBJECT_GPRE_FLAGS) $< $@
  73. $(OBJ)/burp/%.cpp: $(SRC_ROOT)/burp/%.epp
  74. $(GPRE_CURRENT) $(OBJECT_GPRE_FLAGS) $< $@
  75. $(OBJ)/%.cpp: $(SRC_ROOT)/%.epp
  76. $(GPRE_CURRENT) $(GPRE_FLAGS) $(firstword $<) $@
  77. .SUFFIXES: .lo .o .cpp .c .cc
  78. %.o: %.c
  79. $(CC) $(WCFLAGS) -c $(firstword $<) -o $@
  80. %.o: %.cc
  81. $(CC) $(WCFLAGS) -c $(firstword $<) -o $@
  82. $(OBJ)/%.o: $(SRC_ROOT)/%.c
  83. $(CC) $(WCFLAGS) -c $(firstword $<) -o $@
  84. @sed $(INLINE_EDIT_SED) -e "1,2s/:/: \$$(wildcard/" -e "\$$s/\(.*\)/\\1)/" $(patsubst %.o,%.d,$@)
  85. $(OBJ)/%.o: $(SRC_ROOT)/%.m
  86. $(CC) $(WCFLAGS) -c $(firstword $<) -o $@
  87. @sed $(INLINE_EDIT_SED) -e "1,2s/:/: \$$(wildcard/" -e "\$$s/\(.*\)/\\1)/" $(patsubst %.o,%.d,$@)
  88. $(OBJ)/%.o: $(OBJ)/%.cpp
  89. $(CXX) $(WCXXFLAGS) -c $(firstword $<) -o $@
  90. @sed $(INLINE_EDIT_SED) -e "1,2s/:/: \$$(wildcard/" -e "\$$s/\(.*\)/\\1)/" $(patsubst %.o,%.d,$@)
  91. $(OBJ)/%.o: $(SRC_ROOT)/%.cpp
  92. $(CXX) $(WCXXFLAGS) -c $(firstword $<) -o $@
  93. @sed $(INLINE_EDIT_SED) -e "1,2s/:/: \$$(wildcard/" -e "\$$s/\(.*\)/\\1)/" $(patsubst %.o,%.d,$@)
  94. $(OBJ)/%.o: $(ROOT)/%.cpp
  95. $(CC) $(WCFLAGS) -c $(firstword $<) -o $@
  96. @sed $(INLINE_EDIT_SED) -e "1,2s/:/: \$$(wildcard/" -e "\$$s/\(.*\)/\\1)/" $(patsubst %.o,%.d,$@)
  97. .SUFFIXES: .epp .e
  98. # Rules for making resource files
  99. $(GEN_ROOT)/%.res: $(SRC_ROOT)/%.rc
  100. windres --output-format=coff --include-dir=$(<D) $< $@
  101. # Rule for making gbak files when cross-compiling
  102. .SUFFIXES: .gbak .fdb
  103. $(GEN_ROOT)/$(TARGET)/%.gbak: $(GEN_ROOT)/Native/%.fdb
  104. $(RUN_GBAK) -b $(firstword $<) $(firstword $@)
  105. $(GEN_ROOT)/%.gbak: $(GEN_ROOT)/%.fdb
  106. $(RUN_GBAK) -b $(firstword $<) $(firstword $@)