Makefile.in 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380
  1. .PHONY: all clean distclean install uninstall
  2. @DEFINE_DLOPEN_MAKE@
  3. @DEFINE_ZLIB_MAKE@
  4. @DEFINE_DISCMAGE_MAKE@
  5. @DEFINE_USB_MAKE@
  6. @DEFINE_LIBCD64_MAKE@
  7. CC=@CC@
  8. CFLAGS=-I. -Wall -W -O3 @DEFS@
  9. LDFLAGS=-s
  10. TARGETS=
  11. ifdef USE_DISCMAGE
  12. LIBNAME_DM=discmage
  13. endif
  14. # The test for Cygwin should be done before the test for DJGPP, because the
  15. # environment variable DJGPP can be set under Bash for people who have
  16. # installed both GCC (and friends) ports.
  17. GCC_WIN=0
  18. # test cygwin before DJGPP; OSTYPE is not exported on Cygwin
  19. ifeq ($(TERM),cygwin)
  20. GCC_WIN=1
  21. endif
  22. # test msys before DJGPP; MSYS, MinGW's POSIX build environment
  23. ifeq ($(OSTYPE),msys)
  24. GCC_WIN=1
  25. endif
  26. ifeq ($(GCC_WIN),1)
  27. ifdef USE_DISCMAGE
  28. FULLLIBNAME_DM=$(LIBNAME_DM).dll
  29. ifndef DLOPEN
  30. LDFLAGS+=libdiscmage/$(LIBNAME_DM).a
  31. endif
  32. endif
  33. else
  34. ifdef DJGPP
  35. ifdef USE_DISCMAGE
  36. FULLLIBNAME_DM=$(LIBNAME_DM).dxe
  37. ifndef DLOPEN
  38. LDFLAGS+=libdiscmage/$(LIBNAME_DM).a
  39. endif
  40. endif
  41. else # Unix, BeOS or Mac OS X (Darwin)
  42. ifeq ($(findstring openbsd,$(OSTYPE)),openbsd) # for example "openbsd3.4"
  43. # i386_iopl() is located in libi386.a
  44. LDFLAGS+=@LIBI386_MAKE@
  45. endif
  46. ifdef USE_DISCMAGE
  47. ifeq ($(findstring darwin,$(OSTYPE)),darwin) # for example "darwin7.0"
  48. FULLLIBNAME_DM=$(LIBNAME_DM).dylib
  49. else
  50. FULLLIBNAME_DM=$(LIBNAME_DM).so
  51. endif
  52. endif
  53. ifdef DLOPEN
  54. ifneq ($(OSTYPE),beos)
  55. ifeq ($(findstring freebsd,$(OSTYPE)),) # false if OSTYPE contains "freebsd"
  56. ifeq ($(findstring openbsd,$(OSTYPE)),) # false if OSTYPE contains "openbsd"
  57. LDFLAGS+=-ldl
  58. endif
  59. endif
  60. endif
  61. else # DLOPEN
  62. ifdef USE_DISCMAGE # GNU specific: "simply expanded variable"
  63. FULLLIBNAME_DM:=$(addprefix lib,$(FULLLIBNAME_DM))
  64. LDFLAGS+=-Llibdiscmage -l$(LIBNAME_DM)
  65. endif
  66. endif
  67. endif # DJGPP
  68. endif # GCC_WIN
  69. TARGETS+=libdiscmage/$(FULLLIBNAME_DM)
  70. ifdef USE_LIBCD64
  71. LDFLAGS+=backup/libcd64/libcd64.a
  72. TARGETS+=backup/libcd64/libcd64.a
  73. endif
  74. OBJECTS=ucon64.o ucon64_dat.o ucon64_misc.o ucon64_opts.o \
  75. misc/chksum.o misc/file.o misc/getopt.o misc/getopt2.o \
  76. misc/misc.o misc/parallel.o misc/property.o misc/string.o \
  77. patch/aps.o patch/bsl.o patch/gg.o patch/ips.o patch/pal4u.o \
  78. patch/ppf.o patch/xps.o \
  79. console/dc.o console/gb.o console/gba.o console/genesis.o \
  80. console/jaguar.o console/lynx.o console/n64.o console/neogeo.o \
  81. console/nes.o console/ngp.o console/pce.o console/psx.o console/sms.o \
  82. console/snes.o console/swan.o \
  83. backup/cd64.o backup/cmc.o backup/dex.o backup/doctor64.o \
  84. backup/doctor64jr.o backup/f2a.o backup/fal.o backup/ffe.o \
  85. backup/fig.o backup/gbx.o backup/gd.o backup/interceptor.o \
  86. backup/lynxit.o backup/mccl.o backup/mcd.o backup/md-pro.o \
  87. backup/mgd.o backup/msg.o backup/pce-pro.o backup/pl.o \
  88. backup/psxpblib.o backup/sflash.o backup/smc.o backup/smd.o \
  89. backup/smsgg-pro.o backup/ssc.o backup/swc.o backup/tototek.o \
  90. backup/ufo.o backup/yoko.o backup/z64.o
  91. ifdef USE_ZLIB
  92. LDFLAGS+=-lz
  93. OBJECTS+=misc/archive.o misc/map.o misc/unzip.o
  94. endif
  95. ifdef USE_USB
  96. LDFLAGS+=-lusb
  97. OBJECTS+=misc/usb.o
  98. endif
  99. ifdef DLOPEN
  100. OBJECTS+=misc/dlopen.o
  101. ifndef USE_ZLIB
  102. ifeq ($(GCC_WIN),1)
  103. else
  104. ifdef DJGPP # DJGPP code in dlopen needs map code
  105. OBJECTS+=misc/map.o
  106. endif # DJGPP
  107. endif # GCC_WIN
  108. endif # USE_ZLIB
  109. else
  110. ifeq ($(GCC_WIN),1) # Cygwin/MinGW code in ucon64_misc needs dlopen code
  111. OBJECTS+=misc/dlopen.o
  112. endif # GCC_WIN
  113. endif # DLOPEN
  114. TARGET=ucon64
  115. ifeq ($(GCC_WIN),1)
  116. TARGET:=$(addsuffix .exe,$(TARGET)) # adding .exe avoids "problems" with Cygwin/MinGW
  117. else
  118. ifdef DJGPP # OSTYPE is not defined by default under DOS
  119. TARGET:=$(addsuffix .exe,$(TARGET))
  120. endif # DJGPP
  121. endif # GCC_WIN
  122. TARGETS+=$(TARGET)
  123. all: $(TARGETS)
  124. CLEAN_CMD=rm -f $(TARGET) $(OBJECTS) *.core *.stackdump *~ */*~ */*/*~; \
  125. cd libdiscmage && $(MAKE) clean; \
  126. cd ../backup/libcd64 && $(MAKE) clean
  127. clean:
  128. ifeq ($(GCC_WIN),1)
  129. $(CLEAN_CMD)
  130. else
  131. ifdef DJGPP
  132. del *.o
  133. del patch\*.o
  134. del console\*.o
  135. del backup\*.o
  136. del misc\*.o
  137. del $(TARGET)
  138. cd libdiscmage
  139. $(MAKE) clean
  140. cd ../backup/libcd64
  141. $(MAKE) clean
  142. cd ../..
  143. else # Unix, BeOS or Mac OS X (Darwin)
  144. $(CLEAN_CMD)
  145. endif # DJGPP
  146. endif # GCC_WIN
  147. DISTCLEAN_CMD=rm -f Makefile config.log config.status config.cache config.h; \
  148. cd libdiscmage && $(MAKE) distclean; \
  149. cd ../backup/libcd64 && $(MAKE) clean
  150. # libcd64 Makefile has no distclean target
  151. distclean: clean
  152. ifeq ($(GCC_WIN),1)
  153. $(DISTCLEAN_CMD)
  154. else
  155. ifdef DJGPP
  156. del Makefile
  157. del config.log
  158. del config.status
  159. del config.cache
  160. del config.h
  161. cd libdiscmage
  162. $(MAKE) distclean
  163. cd ../backup/libcd64
  164. $(MAKE) clean
  165. cd ../..
  166. else
  167. $(DISTCLEAN_CMD)
  168. endif # DJGPP
  169. endif # GCC_WIN
  170. .c.o:
  171. $(CC) $(CFLAGS) -c $< -o $@
  172. backup/cd64.o: backup/cd64.c
  173. $(CC) $(CFLAGS) -Ibackup/libcd64 -c $< -o $@
  174. ifdef USE_DISCMAGE
  175. libdiscmage/$(FULLLIBNAME_DM):
  176. ifeq ($(GCC_WIN),1)
  177. cd libdiscmage && $(MAKE)
  178. else
  179. ifdef DJGPP
  180. cd libdiscmage
  181. $(MAKE)
  182. cd ..
  183. else
  184. cd libdiscmage && $(MAKE)
  185. endif # DJGPP
  186. endif # GCC_WIN
  187. endif # USE_DISCMAGE
  188. ifdef USE_LIBCD64
  189. backup/libcd64/libcd64.a:
  190. ifeq ($(GCC_WIN),1)
  191. cd backup/libcd64 && $(MAKE)
  192. else
  193. ifdef DJGPP
  194. cd backup/libcd64
  195. $(MAKE)
  196. cd ../..
  197. else
  198. cd backup/libcd64 && $(MAKE)
  199. endif # DJGPP
  200. endif # GCC_WIN
  201. endif # USE_DISCMAGE
  202. $(TARGET): $(OBJECTS)
  203. $(CC) $(OBJECTS) $(LDFLAGS) -o $@
  204. install:
  205. ifeq ($(TERM),cygwin) # test cygwin before DJGPP
  206. else
  207. ifeq ($(OSTYPE),msys) # test msys before DJGPP
  208. else
  209. ifdef DJGPP
  210. else
  211. ifeq ($(OSTYPE),beos)
  212. ./install_beos.sh
  213. else
  214. ./install.sh
  215. endif # beos
  216. endif # DJGPP
  217. endif # msys
  218. endif # cygwin
  219. ifndef DLOPEN
  220. cd libdiscmage && $(MAKE) install
  221. endif
  222. uninstall:
  223. ifeq ($(TERM),cygwin) # test cygwin before DJGPP
  224. else
  225. ifeq ($(OSTYPE),msys) # test msys before DJGPP
  226. else
  227. ifdef DJGPP
  228. else
  229. ifeq ($(OSTYPE),beos)
  230. rm -f $(HOME)/config/bin/$(TARGET)
  231. else
  232. rm -f /usr/local/bin/$(TARGET)
  233. endif # beos
  234. endif # DJGPP
  235. endif # msys
  236. endif # cygwin
  237. ifndef DLOPEN
  238. cd libdiscmage && $(MAKE) uninstall
  239. endif
  240. # Dependencies
  241. # Most source files include these
  242. UCON64_STD_H=ucon64.h ucon64_misc.h misc/misc.h config.h ucon64_defines.h
  243. misc/archive.o: misc/archive.h misc/map.h config.h
  244. misc/chksum.o: misc/chksum.h config.h
  245. misc/dlopen.o: misc/dlopen.h misc/dxedll_pub.h config.h
  246. misc/getopt.o: misc/getopt.h
  247. misc/map.o: misc/map.h config.h
  248. misc/misc.o: misc/misc.h misc/archive.h config.h
  249. misc/parallel.o: misc/parallel.h config.h
  250. misc/usb.o: misc/usb.h config.h
  251. misc/unzip.o: misc/unzip.h config.h
  252. ucon64.o: misc/dlopen.h misc/getopt.h ucon64_dat.h ucon64_opts.h \
  253. console/dc.h console/gb.h console/gba.h console/genesis.h \
  254. console/jaguar.h console/lynx.h console/n64.h console/neogeo.h \
  255. console/nes.h console/ngp.h console/pce.h console/psx.h console/sms.h \
  256. console/snes.h console/swan.h \
  257. backup/cd64.h backup/dex.h backup/doctor64.h backup/doctor64jr.h \
  258. backup/f2a.h backup/fal.h backup/ffe.h backup/fig.h backup/gbx.h \
  259. backup/gd.h backup/interceptor.h backup/lynxit.h backup/mccl.h \
  260. backup/mcd.h backup/md-pro.h backup/mgd.h backup/msg.h \
  261. backup/pce-pro.h backup/pl.h backup/smc.h backup/smd.h \
  262. backup/smsgg-pro.h backup/ssc.h backup/swc.h backup/tototek.h \
  263. backup/ufo.h backup/yoko.h backup/z64.h \
  264. patch/aps.h patch/bsl.h patch/gg.h patch/ips.h patch/pal4u.h \
  265. patch/ppf.h patch/xps.h $(UCON64_STD_H)
  266. ucon64_dat.o: ucon64_dat.h $(UCON64_STD_H)
  267. ucon64_misc.o: misc/dlopen.h $(UCON64_STD_H)
  268. ucon64_opts.o: misc/dlopen.h misc/getopt.h ucon64_dat.h ucon64_opts.h \
  269. console/dc.h console/gb.h console/gba.h console/genesis.h \
  270. console/jaguar.h console/lynx.h console/n64.h console/neogeo.h \
  271. console/nes.h console/ngp.h console/pce.h console/psx.h \
  272. console/sms.h console/snes.h console/swan.h \
  273. backup/cd64.h backup/dex.h backup/doctor64.h \
  274. backup/doctor64jr.h backup/f2a.h backup/fal.h backup/ffe.h \
  275. backup/fig.h backup/gbx.h backup/gd.h backup/interceptor.h \
  276. backup/lynxit.h backup/mccl.h backup/mcd.h backup/md-pro.h \
  277. backup/mgd.h backup/msg.h backup/pce-pro.h backup/pl.h \
  278. backup/smc.h backup/smd.h backup/smsgg-pro.h backup/ssc.h \
  279. backup/swc.h backup/tototek.h backup/ufo.h backup/yoko.h \
  280. backup/z64.h \
  281. patch/aps.h patch/bsl.h patch/gg.h patch/ips.h patch/pal4u.h \
  282. patch/ppf.h patch/xps.h $(UCON64_STD_H)
  283. console/dc.o: console/dc.h $(UCON64_STD_H)
  284. console/gb.o: console/gb.h backup/mgd.h $(UCON64_STD_H)
  285. console/gba.o: console/gba.h $(UCON64_STD_H)
  286. console/genesis.o: console/genesis.h backup/smd.h backup/mgd.h $(UCON64_STD_H)
  287. console/jaguar.o: console/jaguar.h $(UCON64_STD_H)
  288. console/lynx.o: console/lynx.h $(UCON64_STD_H)
  289. console/n64.o: console/n64.h $(UCON64_STD_H)
  290. console/neogeo.o: console/neogeo.h $(UCON64_STD_H)
  291. console/nes.o: console/nes.h $(UCON64_STD_H)
  292. console/ngp.o: console/ngp.h $(UCON64_STD_H)
  293. console/pce.o: console/pce.h backup/mgd.h $(UCON64_STD_H)
  294. console/psx.o: console/psx.h $(UCON64_STD_H)
  295. console/sms.o: console/sms.h backup/smd.h backup/mgd.h $(UCON64_STD_H)
  296. console/snes.o: console/snes.h backup/mgd.h $(UCON64_STD_H)
  297. console/swan.o: console/swan.h $(UCON64_STD_H)
  298. backup/cd64.o: backup/cd64.h $(UCON64_STD_H)
  299. backup/cmc.o: backup/cmc.h $(UCON64_STD_H)
  300. backup/dex.o: backup/dex.h backup/psxpblib.h $(UCON64_STD_H)
  301. backup/doctor64.o: backup/doctor64.h $(UCON64_STD_H)
  302. backup/doctor64jr.o: backup/doctor64jr.h $(UCON64_STD_H)
  303. backup/f2a.o: backup/f2a.h $(UCON64_STD_H)
  304. backup/fal.o: backup/fal.h backup/cartlib.c $(UCON64_STD_H)
  305. backup/ffe.o: backup/ffe.h $(UCON64_STD_H)
  306. backup/fig.o: backup/fig.h console/snes.h $(UCON64_STD_H)
  307. backup/gd.o: backup/gd.h console/snes.h $(UCON64_STD_H)
  308. backup/gbx.o: backup/gbx.h $(UCON64_STD_H)
  309. backup/lynxit.o: backup/lynxit.h $(UCON64_STD_H)
  310. backup/mccl.o: backup/mccl.h $(UCON64_STD_H)
  311. backup/mcd.o: backup/mcd.h $(UCON64_STD_H)
  312. backup/md-pro.o: backup/md-pro.h backup/tototek.h $(UCON64_STD_H)
  313. backup/mgd.o: backup/mgd.h $(UCON64_STD_H)
  314. backup/msg.o: backup/msg.h backup/ffe.h $(UCON64_STD_H)
  315. backup/pce-pro.o: backup/pce-pro.h backup/tototek.h $(UCON64_STD_H)
  316. backup/pl.o: backup/pl.h $(UCON64_STD_H)
  317. backup/psxpblib.o: backup/psxpblib.h $(UCON64_STD_H)
  318. backup/sflash.o: backup/sflash.h backup/tototek.h $(UCON64_STD_H)
  319. backup/smc.o: backup/smc.h backup/ffe.h $(UCON64_STD_H)
  320. backup/smd.o: backup/smd.h backup/ffe.h $(UCON64_STD_H)
  321. backup/smsgg-pro.o: backup/smsgg-pro.h backup/tototek.h $(UCON64_STD_H)
  322. backup/swc.o: backup/swc.h backup/ffe.h console/snes.h $(UCON64_STD_H)
  323. backup/tototek.o: backup/tototek.h $(UCON64_STD_H)
  324. backup/ufo.o: backup/ufo.h $(UCON64_STD_H)
  325. backup/yoko.o: backup/yoko.h $(UCON64_STD_H)
  326. backup/z64.o: backup/z64.h $(UCON64_STD_H)
  327. patch/aps.o: patch/aps.h $(UCON64_STD_H)
  328. patch/bsl.o: patch/bsl.h $(UCON64_STD_H)
  329. patch/gg.o: patch/gg.h $(UCON64_STD_H)
  330. patch/ips.o: patch/ips.h $(UCON64_STD_H)
  331. patch/pal4u.o: patch/pal4u.h $(UCON64_STD_H)
  332. patch/ppf.o: patch/ppf.h $(UCON64_STD_H)
  333. patch/xps.o: patch/xps.h $(UCON64_STD_H)