the small playstation sound emulator

buildsys.mk.in 10KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402
  1. #
  2. # Copyright (c) 2007, Jonathan Schleifer <js@h3c.de>
  3. #
  4. # Permission to use, copy, modify, and/or distribute this software for any
  5. # purpose with or without fee is hereby granted, provided that the above
  6. # copyright notice and this permission notice is present in all copies.
  7. #
  8. # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  9. # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  10. # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  11. # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  12. # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  13. # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  14. # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  15. # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  16. # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  17. # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  18. # POSSIBILITY OF SUCH DAMAGE.
  19. #
  20. PACKAGE = @PACKAGE@
  21. CC = @CC@
  22. CXX = @CXX@
  23. CPP = @CPP@
  24. DC = @DC@
  25. ERLC = @ERLC@
  26. OBJC = @OBJC@
  27. AR = @AR@
  28. LD = ${CC}
  29. CFLAGS = @CFLAGS@
  30. CXXFLAGS = @CXXFLAGS@
  31. CPPFLAGS = @CPPFLAGS@
  32. DFLAGS = @DFLAGS@
  33. ERLCFLAGS = @ERLCFLAGS@
  34. OBJCFLAGS = @OBJCFLAGS@
  35. LDFLAGS = @LDFLAGS@
  36. LIBS = @LIBS@
  37. PROG_IMPLIB_NEEDED = @PROG_IMPLIB_NEEDED@
  38. PROG_IMPLIB_LDFLAGS = @PROG_IMPLIB_LDFLAGS@
  39. PROG_SUFFIX = @EXEEXT@
  40. LIB_CPPFLAGS = @LIB_CPPFLAGS@
  41. LIB_CFLAGS = @LIB_CFLAGS@
  42. LIB_LDFLAGS = @LIB_LDFLAGS@
  43. LIB_PREFIX = @LIB_PREFIX@
  44. LIB_SUFFIX = @LIB_SUFFIX@
  45. PLUGIN_CPPFLAGS = @PLUGIN_CPPFLAGS@
  46. PLUGIN_CFLAGS = @PLUGIN_CFLAGS@
  47. PLUGIN_LDFLAGS = @PLUGIN_LDFLAGS@
  48. PLUGIN_SUFFIX = @PLUGIN_SUFFIX@
  49. INSTALL_LIB = @INSTALL_LIB@
  50. UNINSTALL_LIB = @UNINSTALL_LIB@
  51. CLEAN_LIB = @CLEAN_LIB@
  52. LN_S = @LN_S@
  53. MKDIR_P = mkdir -p
  54. INSTALL = install
  55. SHELL = @SHELL@
  56. prefix = @prefix@
  57. exec_prefix = @exec_prefix@
  58. bindir = @bindir@
  59. libdir = @libdir@
  60. plugindir ?= ${libdir}/${PACKAGE}
  61. datarootdir = @datarootdir@
  62. datadir = @datadir@
  63. includedir = @includedir@
  64. includesubdir ?= ${PACKAGE}
  65. mandir = @mandir@
  66. mansubdir ?= man1
  67. OBJS1 = ${SRCS:.c=.o}
  68. OBJS2 = ${OBJS1:.cc=.o}
  69. OBJS3 = ${OBJS2:.cxx=.o}
  70. OBJS4 = ${OBJS3:.d=.o}
  71. OBJS5 = ${OBJS4:.erl=.beam}
  72. OBJS += ${OBJS5:.m=.o}
  73. .SILENT:
  74. .SUFFIXES: .beam .c .cc .cxx .d .erl .m
  75. .PHONY: all subdirs pre-depend depend install install-extra uninstall uninstall-extra clean distclean
  76. all:
  77. for i in subdirs depend ${STATIC_LIB} ${STATIC_LIB_NOINST} ${LIB} ${LIB_NOINST} ${PLUGIN} ${PLUGIN_NOINST} ${PROG} ${PROG_NOINST}; do \
  78. ${MAKE} ${MFLAGS} $$i || exit 1; \
  79. done
  80. subdirs:
  81. for i in ${SUBDIRS}; do \
  82. ${DIR_ENTER}; \
  83. ${MAKE} ${MFLAGS} || exit 1; \
  84. ${DIR_LEAVE}; \
  85. done
  86. depend: pre-depend ${SRCS}
  87. regen=0; \
  88. test -f .deps || regen=1; \
  89. for i in ${SRCS}; do test $$i -nt .deps && regen=1; done; \
  90. if test x"$$regen" = x"1"; then \
  91. list=""; \
  92. ${DEPEND_STATUS}; \
  93. for i in ${SRCS}; do \
  94. case $${i##*.} in \
  95. c|cc|cxx|m) \
  96. list="$$list $$i"; \
  97. ;; \
  98. esac; \
  99. done; \
  100. if test x"$$list" != "x"; then \
  101. if ${CPP} ${CPPFLAGS} -M $$list >.deps; then \
  102. ${DEPEND_OK}; \
  103. else \
  104. ${DEPEND_FAILED}; \
  105. fi; \
  106. fi; \
  107. fi
  108. pre-depend:
  109. ${PROG} ${PROG_NOINST}: ${EXT_DEPS} ${OBJS}
  110. ${LINK_STATUS}
  111. if ${LD} -o $@ ${OBJS} ${LDFLAGS} ${LIBS}; then \
  112. ${LINK_OK}; \
  113. else \
  114. ${LINK_FAILED}; \
  115. fi
  116. ${LIB} ${LIB_NOINST}: ${EXT_DEPS} ${OBJS}
  117. ${LINK_STATUS}
  118. if ${LD} -o $@ ${OBJS} ${LIB_LDFLAGS} ${LDFLAGS} ${LIBS}; then \
  119. ${LINK_OK}; \
  120. else \
  121. ${LINK_FAILED}; \
  122. fi
  123. ${PLUGIN} ${PLUGIN_NONST}: ${EXT_DEPS} ${OBJS}
  124. ${LINK_STATUS}
  125. if ${LD} -o $@ ${OBJS} ${PLUGIN_LDFLAGS} ${LDFLAGS} ${LIBS}; then \
  126. ${LINK_OK}; \
  127. else \
  128. ${LINK_FAILED}; \
  129. fi
  130. ${STATIC_LIB} ${STATIC_LIB_NOINST}: ${EXT_DEPS} ${OBJS}
  131. ${LINK_STATUS}
  132. if ${AR} cr $@ ${OBJS}; then \
  133. ${LINK_OK}; \
  134. else \
  135. ${LINK_FAILED}; \
  136. fi
  137. .c.o:
  138. ${COMPILE_STATUS}
  139. if ${CC} ${CFLAGS} ${CPPFLAGS} -c -o $@ $<; then \
  140. ${COMPILE_OK}; \
  141. else \
  142. ${COMPILE_FAILED}; \
  143. fi
  144. .cc.o .cxx.o:
  145. ${COMPILE_STATUS}
  146. if ${CXX} ${CXXFLAGS} ${CPPFLAGS} -c -o $@ $<; then \
  147. ${COMPILE_OK}; \
  148. else \
  149. ${COMPILE_FAILED}; \
  150. fi
  151. .d.o:
  152. ${COMPILE_STATUS}
  153. if test x"$(basename ${DC})" = x"dmd"; then \
  154. if ${DC} ${DFLAGS} -c -of$@ $<; then \
  155. ${COMPILE_OK}; \
  156. else \
  157. ${COMPILE_FAILED}; \
  158. fi \
  159. else \
  160. if ${DC} ${DFLAGS} -c -o $@ $<; then \
  161. ${COMPILE_OK}; \
  162. else \
  163. ${COMPILE_FAILED}; \
  164. fi \
  165. fi
  166. .erl.beam:
  167. ${COMPILE_STATUS}
  168. if ${ERLC} ${ERLCFLAGS} -o $@ $<; then \
  169. ${COMPILE_OK}; \
  170. else \
  171. ${COMPILE_FAILED}; \
  172. fi
  173. .m.o:
  174. ${COMPILE_STATUS}
  175. if ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} -c -o $@ $<; then \
  176. ${COMPILE_OK}; \
  177. else \
  178. ${COMPILE_FAILED}; \
  179. fi
  180. install: ${LIB} ${STATIC_LIB} ${PLUGIN} ${PROG} install-extra
  181. for i in ${SUBDIRS}; do \
  182. ${DIR_ENTER}; \
  183. ${MAKE} ${MFLAGS} install || exit 1; \
  184. ${DIR_LEAVE}; \
  185. done
  186. for i in ${LIB}; do \
  187. ${INSTALL_STATUS}; \
  188. if ${MKDIR_P} ${DESTDIR}${libdir} && ${INSTALL_LIB}; then \
  189. ${INSTALL_OK}; \
  190. else \
  191. ${INSTALL_FAILED}; \
  192. fi \
  193. done
  194. for i in ${STATIC_LIB}; do \
  195. ${INSTALL_STATUS}; \
  196. if ${MKDIR_P} ${DESTDIR}${libdir} && ${INSTALL} -m 644 $$i ${DESTDIR}${libdir}/$$i; then \
  197. ${INSTALL_OK}; \
  198. else \
  199. ${INSTALL_FAILED}; \
  200. fi \
  201. done
  202. for i in ${PLUGIN}; do \
  203. ${INSTALL_STATUS}; \
  204. if ${MKDIR_P} ${DESTDIR}${plugindir} && ${INSTALL} -m 755 $$i ${DESTDIR}${plugindir}/$$i; then \
  205. ${INSTALL_OK}; \
  206. else \
  207. ${INSTALL_FAILED}; \
  208. fi \
  209. done
  210. for i in ${DATA}; do \
  211. ${INSTALL_STATUS}; \
  212. if ${MKDIR_P} $$(dirname ${DESTDIR}${datadir}/${PACKAGE}/$$i) && ${INSTALL} -m 644 $$i ${DESTDIR}${datadir}/${PACKAGE}/$$i; then \
  213. ${INSTALL_OK}; \
  214. else \
  215. ${INSTALL_FAILED}; \
  216. fi \
  217. done
  218. for i in ${PROG}; do \
  219. ${INSTALL_STATUS}; \
  220. if ${MKDIR_P} ${DESTDIR}${bindir} && ${INSTALL} -m 755 $$i ${DESTDIR}${bindir}/$$i; then \
  221. ${INSTALL_OK}; \
  222. else \
  223. ${INSTALL_FAILED}; \
  224. fi \
  225. done
  226. for i in ${INCLUDES}; do \
  227. ${INSTALL_STATUS}; \
  228. if ${MKDIR_P} ${DESTDIR}${includedir}/${includesubdir} && ${INSTALL} -m 644 $$i ${DESTDIR}${includedir}/${includesubdir}/$$i; then \
  229. ${INSTALL_OK}; \
  230. else \
  231. ${INSTALL_FAILED}; \
  232. fi \
  233. done
  234. for i in ${MAN}; do \
  235. ${INSTALL_STATUS}; \
  236. if ${MKDIR_P} ${DESTDIR}${mandir}/${mansubdir} && ${INSTALL} -m 644 $$i ${DESTDIR}${mandir}/${mansubdir}/$$i; then \
  237. ${INSTALL_OK}; \
  238. else \
  239. ${INSTALL_FAILED}; \
  240. fi \
  241. done
  242. install-extra:
  243. uninstall: uninstall-extra
  244. for i in ${SUBDIRS}; do \
  245. ${DIR_ENTER}; \
  246. ${MAKE} ${MFLAGS} uninstall || exit 1; \
  247. ${DIR_LEAVE}; \
  248. done
  249. for i in ${LIB}; do \
  250. if test -f ${DESTDIR}${libdir}/$$i; then \
  251. if ${UNINSTALL_LIB}; then \
  252. ${DELETE_OK}; \
  253. else \
  254. ${DELETE_FAILED}; \
  255. fi \
  256. fi; \
  257. done
  258. for i in ${STATIC_LIB}; do \
  259. if test -f ${DESTDIR}${libdir}/$$i; then \
  260. if rm -f ${DESTDIR}${libdir}/$$i; then \
  261. ${DELETE_OK}; \
  262. else \
  263. ${DELETE_FAILED}; \
  264. fi \
  265. fi \
  266. done
  267. for i in ${PLUGIN}; do \
  268. if test -f ${DESTDIR}${plugindir}/$$i; then \
  269. if rm -f ${DESTDIR}${plugindir}/$$i; then \
  270. ${DELETE_OK}; \
  271. else \
  272. ${DELETE_FAILED}; \
  273. fi \
  274. fi \
  275. done
  276. -rmdir ${DESTDIR}${plugindir} >/dev/null 2>&1
  277. for i in ${DATA}; do \
  278. if test -f ${DESTDIR}${datadir}/${PACKAGE}/$$i; then \
  279. if rm -f ${DESTDIR}${datadir}/${PACKAGE}/$$i; then \
  280. ${DELETE_OK}; \
  281. else \
  282. ${DELETE_FAILED}; \
  283. fi \
  284. fi \
  285. done
  286. for i in ${PROG}; do \
  287. if test -f ${DESTDIR}${bindir}/$$i; then \
  288. if rm -f ${DESTDIR}${bindir}/$$i; then \
  289. ${DELETE_OK}; \
  290. else \
  291. ${DELETE_FAILED}; \
  292. fi \
  293. fi \
  294. done
  295. for i in ${INCLUDES}; do \
  296. if test -f ${DESTDIR}${includedir}/${includesubdir}/$$i; then \
  297. if rm -f ${DESTDIR}${includedir}/${includesubdir}/$$i; then \
  298. ${DELETE_OK}; \
  299. else \
  300. ${DELETE_FAILED}; \
  301. fi \
  302. fi \
  303. done
  304. -rmdir ${DESTDIR}${includedir}/${includesubdir} >/dev/null 2>&1
  305. for i in ${MAN}; do \
  306. if test -f ${DESTDIR}${mandir}/${mansubdir}/$$i; then \
  307. if rm -f ${DESTDIR}${mandir}/${mansubdir}/$$i; then \
  308. ${DELETE_OK}; \
  309. else \
  310. ${DELETE_FAILED}; \
  311. fi \
  312. fi \
  313. done
  314. uninstall-extra:
  315. clean:
  316. for i in ${SUBDIRS}; do \
  317. ${DIR_ENTER}; \
  318. ${MAKE} ${MFLAGS} clean || exit 1; \
  319. ${DIR_LEAVE}; \
  320. done
  321. for i in ${OBJS} ${CLEAN} ${CLEAN_LIB} .deps; do \
  322. if test -f $$i -o -d $$i; then \
  323. if rm -fr $$i; then \
  324. ${DELETE_OK}; \
  325. else \
  326. ${DELETE_FAILED}; \
  327. fi \
  328. fi \
  329. done
  330. distclean: clean
  331. for i in ${SUBDIRS}; do \
  332. ${DIR_ENTER}; \
  333. ${MAKE} ${MFLAGS} distclean || exit 1; \
  334. ${DIR_LEAVE}; \
  335. done
  336. for i in ${PROG} ${PROG_NOINST} ${LIB} ${LIB_NOINST} ${STATIC_LIB} ${STATIC_LIB_NOINST} ${PLUGIN} ${PLUGIN_NOINST} ${DISTCLEAN} *~; do \
  337. if test -f $$i -o -d $$i; then \
  338. if rm -fr $$i; then \
  339. ${DELETE_OK}; \
  340. else \
  341. ${DELETE_FAILED}; \
  342. fi \
  343. fi \
  344. done
  345. DIR_ENTER = printf "\033[K\033[0;36mEntering directory \033[1;36m$$i\033[0;36m.\033[0m\n"; cd $$i || exit 1
  346. DIR_LEAVE = printf "\033[K\033[0;36mLeaving directory \033[1;36m$$i\033[0;36m.\033[0m\n"; cd .. || exit 1
  347. DEPEND_STATUS = printf "\033[K\033[0;33mGenerating dependencies...\033[0m\r"
  348. DEPEND_OK = printf "\033[K\033[0;32mSuccessfully generated dependencies.\033[0m\n"
  349. DEPEND_FAILED = printf "\033[K\033[0;31mFailed to generate dependencies!\033[0m\n"; exit 1
  350. COMPILE_STATUS = printf "\033[K\033[0;33mCompiling \033[1;33m$<\033[0;33m...\033[0m\r"
  351. COMPILE_OK = printf "\033[K\033[0;32mSuccessfully compiled \033[1;32m$<\033[0;32m.\033[0m\n"
  352. COMPILE_FAILED = printf "\033[K\033[0;31mFailed to compile \033[1;31m$<\033[0;31m!\033[0m\n"; exit 1
  353. LINK_STATUS = printf "\033[K\033[0;33mLinking \033[1;33m$@\033[0;33m...\033[0m\r"
  354. LINK_OK = printf "\033[K\033[0;32mSuccessfully linked \033[1;32m$@\033[0;32m.\033[0m\n"
  355. LINK_FAILED = printf "\033[K\033[0;31mFailed to link \033[1;31m$@\033[0;31m!\033[0m\n"; exit 1
  356. INSTALL_STATUS = printf "\033[K\033[0;33mInstalling \033[1;33m$$i\033[0;33m...\033[0m\r"
  357. INSTALL_OK = printf "\033[K\033[0;32mSuccessfully installed \033[1;32m$$i\033[0;32m.\033[0m\n"
  358. INSTALL_FAILED = printf "\033[K\033[0;31mFailed to install \033[1;31m$$i\033[0;31m!\033[0m\n"; exit 1
  359. DELETE_OK = printf "\033[K\033[0;34mDeleted \033[1;34m$$i\033[0;34m.\033[0m\n"
  360. DELETE_FAILED = printf "\033[K\033[0;31mFailed to delete \033[1;31m$$i\033[0;31m!\033[0m\n"; exit 1
  361. -include .deps