config.mk 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. # FLAC - Free Lossless Audio Codec
  2. # Copyright (C) 2001-2009 Josh Coalson
  3. # Copyright (C) 2011-2016 Xiph.Org Foundation
  4. #
  5. # This file is part the FLAC project. FLAC is comprised of several
  6. # components distributed under different licenses. The codec libraries
  7. # are distributed under Xiph.Org's BSD-like license (see the file
  8. # COPYING.Xiph in this distribution). All other programs, libraries, and
  9. # plugins are distributed under the GPL (see COPYING.GPL). The documentation
  10. # is distributed under the Gnu FDL (see COPYING.FDL). Each file in the
  11. # FLAC distribution contains at the top the terms under which it may be
  12. # distributed.
  13. #
  14. # Since this particular file is relevant to all components of FLAC,
  15. # it may be distributed under the Xiph.Org license, which is the least
  16. # restrictive of those mentioned above. See the file COPYING.Xiph in this
  17. # distribution.
  18. #
  19. # customizable settings from the make invocation
  20. #
  21. USE_OGG ?= 1
  22. USE_ICONV ?= 1
  23. USE_LROUND ?= 1
  24. USE_FSEEKO ?= 1
  25. USE_LANGINFO_CODESET ?= 1
  26. #
  27. # debug/release selection
  28. #
  29. DEFAULT_BUILD = release
  30. F_PIC := -fPIC
  31. # returns Linux, Darwin, FreeBSD, etc.
  32. ifndef OS
  33. OS := $(shell uname -s)
  34. endif
  35. # returns i386, x86_64, powerpc, etc.
  36. ifndef PROC
  37. ifeq ($(findstring Windows,$(OS)),Windows)
  38. PROC := i386 # failsafe
  39. # ifeq ($(findstring i686,$(shell gcc -dumpmachine)),i686) # MinGW-w64: i686-w64-mingw32
  40. ifeq ($(findstring x86_64,$(shell gcc -dumpmachine)),x86_64) # MinGW-w64: x86_64-w64-mingw32
  41. PROC := x86_64
  42. endif
  43. else
  44. ifeq ($(shell uname -p),amd64)
  45. PROC := x86_64
  46. else
  47. PROC := $(shell uname -p)
  48. endif
  49. endif
  50. endif
  51. ifeq ($(PROC),powerpc)
  52. PROC := ppc
  53. endif
  54. # x64_64 Mac OS outputs 'i386' in uname -p; use uname -m instead
  55. ifeq ($(PROC),i386)
  56. ifeq ($(OS),Darwin)
  57. PROC := $(shell uname -m)
  58. endif
  59. endif
  60. ifeq ($(OS),Linux)
  61. PROC := $(shell uname -m)
  62. USE_ICONV := 0
  63. endif
  64. ifeq ($(findstring Windows,$(OS)),Windows)
  65. F_PIC :=
  66. USE_ICONV := 0
  67. USE_LANGINFO_CODESET := 0
  68. ifeq (mingw32,$(shell gcc -dumpmachine)) # MinGW (mainline): mingw32
  69. USE_FSEEKO := 0
  70. endif
  71. endif
  72. debug : BUILD = debug
  73. valgrind : BUILD = debug
  74. release : BUILD = release
  75. # override LINKAGE on OS X until we figure out how to get 'cc -static' to work
  76. ifeq ($(OS),Darwin)
  77. LINKAGE = -arch $(PROC)
  78. else
  79. debug : LINKAGE = -static
  80. valgrind : LINKAGE = -dynamic
  81. release : LINKAGE = -static
  82. endif
  83. all default: $(DEFAULT_BUILD)
  84. #
  85. # GNU makefile fragment for emulating stuff normally done by configure
  86. #
  87. VERSION=\"1.3.2\"
  88. CONFIG_CFLAGS=$(CUSTOM_CFLAGS) -DHAVE_STDINT_H -DHAVE_INTTYPES_H -DHAVE_CXX_VARARRAYS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
  89. ifeq ($(OS),Darwin)
  90. CONFIG_CFLAGS += -DFLAC__SYS_DARWIN -DHAVE_SYS_PARAM_H -arch $(PROC)
  91. else
  92. CONFIG_CFLAGS += -DHAVE_SOCKLEN_T
  93. endif
  94. ifeq ($(PROC),ppc)
  95. CONFIG_CFLAGS += -DWORDS_BIGENDIAN=1 -DCPU_IS_LITTLE_ENDIAN=0
  96. else
  97. CONFIG_CFLAGS += -DWORDS_BIGENDIAN=0 -DCPU_IS_LITTLE_ENDIAN=1
  98. endif
  99. ifeq ($(OS),Linux)
  100. ifeq ($(PROC),x86_64)
  101. CONFIG_CFLAGS += -fPIC
  102. endif
  103. endif
  104. ifeq ($(OS),FreeBSD)
  105. CONFIG_CFLAGS += -DHAVE_SYS_PARAM_H
  106. endif
  107. ifneq (0,$(USE_ICONV))
  108. CONFIG_CFLAGS += -DHAVE_ICONV
  109. ICONV_LIBS = -liconv
  110. else
  111. ICONV_LIBS =
  112. endif
  113. ifneq (0,$(USE_OGG))
  114. CONFIG_CFLAGS += -DFLAC__HAS_OGG=1
  115. OGG_INCLUDES = -I$(OGG_INCLUDE_DIR)
  116. OGG_EXPLICIT_LIBS = $(OGG_LIB_DIR)/libogg.a
  117. OGG_LIBS = -L$(OGG_LIB_DIR) -logg
  118. OGG_SRCS = $(OGG_SRCS_C)
  119. else
  120. CONFIG_CFLAGS += -DFLAC__HAS_OGG=0
  121. OGG_INCLUDES =
  122. OGG_EXPLICIT_LIBS =
  123. OGG_LIBS =
  124. OGG_SRCS =
  125. endif
  126. OGG_INCLUDE_DIR=$(HOME)/local/include
  127. OGG_LIB_DIR=$(HOME)/local/lib
  128. ifneq (0,$(USE_LROUND))
  129. CONFIG_CFLAGS += -DHAVE_LROUND
  130. endif
  131. ifneq (0,$(USE_FSEEKO))
  132. CONFIG_CFLAGS += -DHAVE_FSEEKO
  133. endif
  134. ifneq (0,$(USE_LANGINFO_CODESET))
  135. CONFIG_CFLAGS += -DHAVE_LANGINFO_CODESET
  136. endif