home *** CD-ROM | disk | FTP | other *** search
/ Openstep 4.2 (Developer) / Openstep Developer 4.2.iso / NextDeveloper / Makefiles / pb_makefiles / flags.make < prev    next >
Encoding:
Text File  |  1997-03-21  |  8.3 KB  |  206 lines

  1. #
  2. # flags.make
  3. #
  4. # This makefile defines the flags which are passed to the compiler, linker,
  5. # and other build tools.  With the exception of the LDFLAGS, all flags found
  6. # here are used by the commands in implicitrules.make
  7. #
  8. # IMPORTED VARIABLES
  9. #    You may define the following variables in your Makefile.preamble
  10. #
  11. #    OTHER_CFLAGS, LOCAL_CFLAGS:  additional flags to pass to the compiler
  12. #    Note that $(OTHER_CFLAGS) and $(LOCAL_CFLAGS) are used for .h, .c, .m,
  13. #    .cc, .cxx, .C, .mm, and .M files.  There is no need to respecify the
  14. #    flags in OTHER_MFLAGS, etc.
  15. #    Note also that OTHER_... flags are inherited by subprojects, while 
  16. #    LOCAL_... flags are only used by the current project.
  17. #    OTHER_MFLAGS, LOCAL_MFLAGS:  additional flags for .m files
  18. #    OTHER_CCFLAGS, LOCAL_CCFLAGS:  additional flags for .cc, .cxx, and .C files
  19. #    OTHER_MMFLAGS, LOCAL_MMFLAGS:  additional flags for .mm and .M files
  20. #    OTHER_PRECOMPFLAGS, LOCAL_PRECOMPFLAGS:  additional flags used when
  21. #    precompiling header files
  22. #    OTHER_LDFLAGS, LOCAL_LDFLAGS:  additional flags passed to ld and libtool
  23. #    OTHER_PSWFLAGS, LOCAL_PSWFLAGS:  additional flags passed to pswrap
  24. #    OTHER_RPCFLAGS, LOCAL_RPCFLAGS:  additional flags passed to rpcgen
  25. #    OTHER_YFLAGS, LOCAL_YFLAGS:  additional flags passed to yacc
  26. #    OTHER_LFLAGS, LOCAL_LFLAGS:  additional flags passed to lex
  27. #
  28. # EXPORTED VARIABLES
  29. #    You may use the following variables in your rules.
  30. #
  31. #    ALL_CFLAGS:  flags to pass when compiling .c files
  32. #    ALL_MFLAGS:  flags to pass when compiling .m files
  33. #    ALL_CCFLAGS:  flags to pass when compiling .cc, .cxx, and .C files
  34. #    ALL_MMFLAGS:  flags to pass when compiling .mm, .mxx, and .M files
  35. #    ALL_PRECOMPFLAGS:  flags to pass when precompiling .h files
  36. #    ALL_LDFLAGS:  flags to pass when linking object files
  37. #    ALL_LIBTOOL_FLAGS:  flags to pass when libtooling object files
  38. #    ALL_PSWFLAGS:  flags to pass when processing .psw and .pswm (pswrap) files
  39. #    ALL_RPCFLAGS:  flags to pass when processing .rpc (rpcgen) files
  40. #    ALL_YFLAGS:  flags to pass when processing .y (yacc) files
  41. #    ALL_LFLAGS:  flags to pass when processing .l (lex) files
  42. #
  43. # OVERRIDABLE VARIBLES
  44. #    The following variables are defined by flags.make and may be overridden
  45. #    in your makefile.postamble.
  46. #
  47. #    WARNING_CFLAGS:  flag used to set warning level (defaults to -Wmost)
  48. #    DEBUG_SYMBOLS_CFLAGS:  debug-symbol flag passed to all builds (defaults
  49. #    to -g)
  50. #    DEBUG_BUILD_CFLAGS:  flags passed during debug builds (defaults to -DDEBUG)
  51. #    OPTIMIZE_BUILD_CFLAGS:  flags passed during optimized builds (defaults
  52. #    to -O)
  53. #    PROFILE_BUILD_CFLAGS:  flags passed during profile builds (defaults
  54. #    to -pg -DPROFILE)
  55. #    LOCAL_DIR_INCLUDE_DIRECTIVE:  flag used to add current directory to
  56. #    the include path (defaults to -I.)
  57. #    DEBUG_BUILD_LDFLAGS, OPTIMIZE_BUILD_LDFLAGS, PROFILE_BUILD_LDFLAGS: flags
  58. #    passed to ld/libtool (default to nothing)
  59. #
  60.  
  61. #
  62. # OS-specific flags
  63. #
  64.  
  65. ifeq "NEXTSTEP" "$(OS)"
  66. OS_CFLAGS = -pipe
  67. OS_LDFLAGS = $(SECTORDER_FLAGS)
  68. endif
  69.  
  70. #
  71. # flags defined in Makefile by ProjectBuilder
  72. #
  73.  
  74. PB_CFLAGS += $($(OS)_PB_CFLAGS)
  75. PB_MFLAGS += $($(OS)_PB_MFLAGS)
  76. PB_CCFLAGS += $($(OS)_PB_CCFLAGS)
  77. PB_MMFLAGS += $($(OS)_PB_MMFLAGS)
  78. PB_PRECOMPFLAGS += $($(OS)_PRECOMPFLAGS)
  79. PB_LDFLAGS += $($(OS)_PB_LDFLAGS)
  80. PB_PSWFLAGS += $($(OS)_PB_PSWFLAGS)
  81. PB_RPCFLAGS += $($(OS)_PB_RPCFLAGS)
  82. PB_YFLAGS += $($(OS)_PB_YFLAGS)
  83. PB_LFLAGS += $($(OS)_PB_LFLAGS)
  84.  
  85. #
  86. # optional flags -- note that optimization is on by default
  87. #
  88.  
  89. export OPTIMIZE
  90. export DEBUG
  91. export PROFILE
  92.  
  93. ifndef OPTIMIZE
  94. OPTIMIZE = YES
  95. endif
  96.  
  97. DEBUG_SYMBOLS_CFLAG = -g # this flag is passed to all builds, not just debug builds
  98. DEBUG_BUILD_CFLAGS = -DDEBUG # this flags is only passed to debug builds
  99. DEBUG_BUILD_LDFLAGS =
  100. OPTIMIZE_BUILD_CFLAGS = -O
  101. OPTIMIZE_BUILD_LDFLAGS =
  102. PROFILE_BUILD_CFLAGS = -pg -DPROFILE
  103. PROFILE_BUILD_LDFLAGS = -pg
  104.  
  105. # the ifndef is an optimization -- OFILE_DIR is specified on the command line
  106. # for recursion, so there's no need to spend time invoking the shell.
  107. ifndef RECURSING
  108. OFILE_DIR_SUFFIX := $(OFILE_DIR_SUFFIX)-$(shell echo $(TARGET_ARCHS) | tr " " "-")
  109. endif
  110.  
  111. ifeq "YES" "$(OPTIMIZE)"
  112. OPTIONAL_CFLAGS += $(OPTIMIZE_BUILD_CFLAGS)
  113. OPTIONAL_LDFLAGS += $(OPTIMIZE_BUILD_LDFLAGS)
  114. OPTIONAL_LIBS += $(OPTIMIZE_BUILD_LIBS)
  115. OPTIONAL_FRAMEWORKS += $(OPTIMIZE_BUILD_FRAMEWORKS)
  116. OFILE_DIR_SUFFIX := $(OFILE_DIR_SUFFIX)-opt
  117. endif
  118.  
  119. ifeq "YES" "$(DEBUG)"
  120. OPTIONAL_CFLAGS += $(DEBUG_BUILD_CFLAGS)
  121. OPTIONAL_LDFLAGS += $(DEBUG_BUILD_LDFLAGS)
  122. OPTIONAL_LIBS += $(DEBUG_BUILD_LIBS)
  123. OPTIONAL_FRAMEWORKS += $(DEBUG_BUILD_FRAMEWORKS)
  124. OFILE_DIR_SUFFIX := $(OFILE_DIR_SUFFIX)-debug
  125. endif
  126.  
  127. ifeq "YES" "$(PROFILE)"
  128. OPTIONAL_CFLAGS += $(PROFILE_BUILD_CFLAGS)
  129. OPTIONAL_LDFLAGS += $(PROFILE_BUILD_LDFLAGS)
  130. OPTIONAL_LIBS += $(PROFILE_BUILD_LIBS)
  131. OPTIONAL_FRAMEWORKS += $(PROFILE_BUILD_FRAMEWORKS)
  132. OFILE_DIR_SUFFIX := $(OFILE_DIR_SUFFIX)-profile
  133. endif
  134.  
  135. #
  136. # recursive flags
  137. #
  138. # IGNORE_RECURSIVE_FLAGS controls when these recursive flags are appended to.
  139. # Recursive makes into PBProject subprojects always append.  Utility invocations of
  140. # make at the top level (e.g. see common.make) do not append.
  141. #
  142. ifneq "$(IGNORE_RECURSIVE_FLAGS)" "YES"
  143.  
  144. export RECURSIVE_CFLAGS += $(HEADER_PATHS) $(FRAMEWORK_PATHS) $(PB_CFLAGS) $(OTHER_CFLAGS)
  145. export RECURSIVE_MFLAGS += $(OTHER_MFLAGS)
  146. export RECURSIVE_CCFLAGS += $(OTHER_CCFLAGS)
  147. export RECURSIVE_MMFLAGS += $(OTHER_MMFLAGS)
  148. export RECURSIVE_PRECOMPFLAGS += $(OTHER_PRECOMPFLAGS)
  149. export RECURSIVE_LDFLAGS += $(FRAMEWORK_PATHS) $(LIBRARY_PATHS) $(OTHER_LDFLAGS)
  150. export RECURSIVE_PSWFLAGS += $(OTHER_PSWFLAGS)
  151. export RECURSIVE_RPCFLAGS += $(OTHER_RPCFLAGS)
  152. export RECURSIVE_YFLAGS  += $(OTHER_YFLAGS)
  153. export RECURSIVE_LFLAGS  += $(OTHER_LFLAGS)
  154. export IGNORE_RECURSIVE_FLAGS = YES
  155. endif
  156.  
  157. CUMULATIVE_VARIABLES += RECURSIVE_CFLAGS RECURSIVE_MFLAGS RECURSIVE_CCFLAGS RECURSIVE_MMFLAGS RECURSIVE_PRECOMPFLAGS RECURSIVE_LDFLAGS RECURSIVE_PSWFLAGS RECURSIVE_RPCFLAGS RECURSIVE_YFLAGS RECURSIVE_LFLAGS
  158.  
  159. RESET_CUMULATIVE_VARIABLES = $(foreach X,$(CUMULATIVE_VARIABLES), "$(X)=$($(X))")
  160.  
  161. #
  162. # nonrecursive flags
  163. #
  164.  
  165. JAVAC_ARG = -javac $(JAVAC)
  166.  
  167. ARCHITECTURE_FLAGS = $(addprefix -arch ,$(TARGET_ARCHS))
  168. LOCAL_DIR_INCLUDE_DIRECTIVE = -I.
  169. WARNING_CFLAGS = -Wmost
  170.  
  171. NONRECURSIVE_CFLAGS  = $(WARNING_CFLAGS) $(DEBUG_SYMBOLS_CFLAG) -fno-common -I$(PROJECT_HDR_DIR) -I$(PRIVATE_HDR_DIR) -I$(PUBLIC_HDR_DIR) -I$(SFILE_DIR) $(LOCAL_DIR_INCLUDE_DIRECTIVE) $(ARCHITECTURE_FLAGS) $(OS_CFLAGS) $(PROJTYPE_CFLAGS) $(PB_CFLAGS) $(LOCAL_CFLAGS)
  172. NONRECURSIVE_MFLAGS  = -ObjC $(OS_MFLAGS) $(PROJTYPE_MFLAGS) $(PB_MFLAGS) $(LOCAL_MFLAGS)
  173. NONRECURSIVE_CCFLAGS = $(OS_CCFLAGS) $(PROJTYPE_CCFLAGS) $(PB_CCFLAGS) $(LOCAL_CCFLAGS)
  174. NONRECURSIVE_MMFLAGS = -ObjC++ $(OS_MMFLAGS) $(PROJTYPE_MMFLAGS) $(PB_MMFLAGS) $(LOCAL_MMFLAGS)
  175. NONRECURSIVE_PRECOMPFLAGS = -precomp $(OS_PRECOMPFLAGS) $(PROJTYPE_PRECOMPFLAGS) $(PB_PRECOMPFLAGS) $(LOCAL_PRECOMPFLAGS)
  176. NONRECURSIVE_LDFLAGS = -L$(OFILE_DIR) $(OS_LDFLAGS) $(PROJTYPE_LDFLAGS) $(PB_LDFLAGS) $(LOCAL_LDFLAGS)
  177. NONRECURSIVE_PSWFLAGS = -H AppKit $(PROJTYPE_PSWFLAGS) $(PB_PSWFLAGS) $(LOCAL_PSWFLAGS)
  178. NONRECURSIVE_RPCFLAGS = $(PROJTYPE_RPCFLAGS) $(PB_RPCFLAGS)
  179. NONRECURSIVE_YFLAGS  = -d $(OS_YFLAGS) $(PROJTYPE_YFLAGS) $(PB_YFLAGS) $(LOCAL_YFLAGS)
  180. NONRECURSIVE_LFLAGS  = $(OS_LFLAGS) $(PROJTYPE_LFLAGS) $(PB_LFLAGS) $(LOCAL_LFLAGS)
  181.  
  182. #
  183. # build flags
  184. #
  185.  
  186. ALL_COMMON_CFLAGS = $(RC_CFLAGS) $(OPTIONAL_CFLAGS) $(NONRECURSIVE_CFLAGS) $(RECURSIVE_CFLAGS)
  187. ALL_COMMON_MFLAGS =  $(ALL_COMMON_CFLAGS) $(NONRECURSIVE_MFLAGS) $(RECURSIVE_MFLAGS)
  188. ALL_COMMON_CCFLAGS = $(ALL_COMMON_CFLAGS) $(NONRECURSIVE_CCFLAGS) $(RECURSIVE_CCFLAGS)
  189. ALL_COMMON_MMFLAGS = $(ALL_COMMON_CFLAGS) $(NONRECURSIVE_MMFLAGS) $(RECURSIVE_MMFLAGS)
  190. ALL_CFLAGS = $(ALL_COMMON_CFLAGS) $(DEPENDS_CFLAGS)
  191. ALL_MFLAGS = $(ALL_COMMON_MFLAGS) $(DEPENDS_CFLAGS)
  192. ALL_CCFLAGS = $(ALL_COMMON_CCFLAGS) $(DEPENDS_CFLAGS)
  193. ALL_MMFLAGS = $(ALL_COMMON_MMFLAGS) $(DEPENDS_CFLAGS)
  194. ALL_PRECOMPFLAGS = $(ALL_COMMON_CFLAGS) $(NONRECURSIVE_PRECOMPFLAGS) $(RECURSIVE_PRECOMPFLAGS)
  195.  
  196. ALL_LDFLAGS = $(OPTIONAL_LDFLAGS) $(NONRECURSIVE_LDFLAGS) $(RECURSIVE_LDFLAGS)
  197. ifeq "$(LIBRARY_STYLE)" "STATIC"
  198. ALL_LIBTOOL_FLAGS = $(filter-out -pg, $(filter-out -g, $(ALL_LDFLAGS)))
  199. else
  200. ALL_LIBTOOL_FLAGS = $(ALL_LDFLAGS)
  201. endif
  202. ALL_PSWFLAGS = $(NONRECURSIVE_PSWFLAGS) $(RECURSIVE_PSWFLAGS)
  203. ALL_RPCFLAGS = $(NONRECURSIVE_RPCFLAGS) $(RECURSIVE_RPCFLAGS)
  204. ALL_YFLAGS = $(NONRECURSIVE_YFLAGS) $(RECURSIVE_YFLAGS)
  205. ALL_LFLAGS = $(NONRECURSIVE_LFLAGS) $(RECURSIVE_LFLAGS)
  206.