Makefile 30 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070
  1. #####################################################################
  2. ## __ __ _ ___________ ##
  3. ## \ \ / /| |____ ____| ##
  4. ## \ \ / / | | | | ##
  5. ## \ \ /\ / / | | | | ##
  6. ## \ \/ \/ / | | | | ##
  7. ## \ /\ / | | | | ##
  8. ## \/ \/ |_| |_| ##
  9. ## ##
  10. ## Wiimms ISO Tools ##
  11. ## https://wit.wiimm.de/ ##
  12. ## ##
  13. #####################################################################
  14. ## ##
  15. ## This file is part of the WIT project. ##
  16. ## Visit https://wit.wiimm.de/ for project details and sources. ##
  17. ## ##
  18. ## Copyright (c) 2009-2021 by Dirk Clemens <wiimm@wiimm.de> ##
  19. ## ##
  20. #####################################################################
  21. #----------------------------------------------------------------
  22. # make manual: http://www.gnu.org/software/make/manual/make.html
  23. #----------------------------------------------------------------
  24. #-------------------------------------------------------------------------------
  25. # global settings
  26. MYMAKE := $(lastword $(MAKEFILE_LIST))
  27. #SHELL = /bin/bash
  28. SHELL = /usr/bin/env bash
  29. AUTHOR = Dirk Clemens
  30. TOOLSET_SHORT = WIT
  31. TOOLSET_LONG = Wiimms ISO Tools
  32. WIT_SHORT = wit
  33. WIT_LONG = Wiimms ISO Tool
  34. WWT_SHORT = wwt
  35. WWT_LONG = Wiimms WBFS Tool
  36. WDF_SHORT = wdf
  37. WDF_LONG = Wiimms WDF Tool
  38. WFUSE_SHORT = wfuse
  39. WFUSE_LONG = Wiimms FUSE Tool
  40. VERSION_NUM = 3.05a
  41. BETA_VERSION = 0
  42. # 0:off -1:"beta" >0:"beta#"
  43. URI_HOME = https://wit.wiimm.de/
  44. URI_DOWNLOAD = https://wit.wiimm.de/download
  45. URI_FILE = https://wit.wiimm.de/file
  46. ifeq ($(BETA_VERSION),0)
  47. URI_REPOS = http://opensvn.wiimm.de/wii/trunk/wiimms-iso-tools/
  48. URI_VIEWVC = https://wit.wiimm.de/r/viewvc
  49. else
  50. URI_REPOS = http://opensvn.wiimm.de/wii/branches/public/wiimms-iso-tools/
  51. URI_VIEWVC = https://wit.wiimm.de/r/viewvc-beta
  52. endif
  53. URI_WDF = https://wit.wiimm.de/r/wdf
  54. URI_CISO = https://wit.wiimm.de/r/ciso
  55. URI_QTWITGUI = https://wit.wiimm.de/r/qtwitgui
  56. URI_WIIBAFU = https://wit.wiimm.de/r/wiibafu
  57. #URI_WCDWM = https://wit.wiimm.de/r/wcdwm
  58. #URI_WIIJMANAGER = https://wit.wiimm.de/r/wiijman
  59. URI_MACWITGUI = https://wit.wiimm.de/r/mac-witgui
  60. URI_GBATEMP = http://gbatemp.net/index.php?showtopic=182236\#entry2286365
  61. URI_DOWNLOAD_I386 = $(URI_DOWNLOAD)/$(DISTRIB_I386)
  62. URI_DOWNLOAD_X86_64 = $(URI_DOWNLOAD)/$(DISTRIB_X86_64)
  63. URI_DOWNLOAD_MAC = $(URI_DOWNLOAD)/$(DISTRIB_MAC)
  64. URI_DOWNLOAD_CYGWIN = $(URI_DOWNLOAD)/$(DISTRIB_CYGWIN)
  65. URI_TITLES = http://gametdb.com/titles.txt
  66. DOWNLOAD_DIR = /n/www/wit.wiimm.de/download
  67. EXPORT_DIR = /cygdrive/n/wit/wiimms-iso-tools/bin
  68. DUMMY := $(shell $(SHELL) ./setup.sh)
  69. include Makefile.setup
  70. #------------------------------------------------------------------------------
  71. # format for logging messages, $1=job, $2=object, $3=more info
  72. LOGFORMAT := \33[36;1m*** %7s %-17s %s\33[0m\n
  73. LOGFORMAT_CC := \33[33;1m*** %7s %-17s %s\33[0m\n
  74. LOGFORMAT_TOOL := \33[35;1m*** %7s %-17s %s\33[0m\n
  75. LOGFORMAT_INST := \33[32;1m*** %7s %-17s %s\33[0m\n
  76. #------------------------------------------------------------------------------
  77. # include source library definitions
  78. DCLIB_MYSQL := 0
  79. include ./dclib/Makefile.inc
  80. #-------------------------------------------------------------------------------
  81. # version+beta settings
  82. ifeq ($(BETA_VERSION),0)
  83. BETA_SUFFIX :=
  84. else ifeq ($(BETA_VERSION),-1)
  85. BETA_SUFFIX := .beta
  86. else
  87. BETA_SUFFIX := .beta$(BETA_VERSION)
  88. endif
  89. VERSION := $(VERSION_NUM)$(BETA_SUFFIX)
  90. #-------------------------------------------------------------------------------
  91. # compiler settings
  92. PRE ?=
  93. CC = $(PRE)gcc
  94. CPP = $(PRE)g++
  95. STRIP = $(PRE)strip
  96. #-------------------------------------------------------------------------------
  97. # files
  98. DIR_LIST =
  99. RM_FILES = *.{a,o,d,tmp,bak,exe} */*.{tmp,bak} */*/*.{tmp,bak}
  100. RM_FILES2 = *.{iso,ciso,wdf,wbfs} templates.sed Makefile.setup
  101. MODE_FILE = ./_mode.flag
  102. MODE = $(shell test -s $(MODE_FILE) && cat $(MODE_FILE))
  103. RM_FILES += $(MODE_FILE)
  104. # wbfs: files / size in GiB of WBFS partition / number of ISO files to copy
  105. WBFS_FILE ?= a.wbfs
  106. WBFS_FILES ?= $(WBFS_FILE) b.wbfs c.wbfs d.wbfs
  107. WBFS_SIZE ?= 20
  108. WBFS_COUNT ?= 4
  109. #-------------------------------------------------------------------------------
  110. # tools
  111. MAIN_TOOLS := wit wwt wdf
  112. TEST_TOOLS := wtest
  113. EXTRA_TOOLS :=
  114. ifeq ($(HAVE_FUSE),1)
  115. MAIN_TOOLS += wfuse
  116. else
  117. EXTRA_TOOLS := wfuse
  118. endif
  119. ALL_TOOLS := $(sort $(MAIN_TOOLS) $(TEST_TOOLS))
  120. ALL_TOOLS_X := $(sort $(MAIN_TOOLS) $(TEST_TOOLS) $(EXTRA_TOOLS))
  121. HELPER_TOOLS := gen-ui
  122. WDF_TEST_LINKS := WdfCat UnWdf WdfCmp WdfDump Ciso CisoCat UnCiso Wbi
  123. WDF_LINKS := wdf-cat wdf-dump
  124. RM_FILES += $(ALL_TOOLS_X) $(HELPER_TOOLS) $(WDF_LINKS) $(WDF_TEST_LINKS)
  125. #-------------------------------------------------------------------------------
  126. # tool dependent options and objects
  127. ifeq ($(STATIC),1)
  128. OPT_STATIC := -static -DDCLIB_STATIC=1
  129. else
  130. OPT_STATIC :=
  131. endif
  132. #---------------
  133. TOPT_wit := $(OPT_STATIC)
  134. TOPT_wwt := $(OPT_STATIC)
  135. TOPT_wdf := $(OPT_STATIC)
  136. TOPT_wfuse := -lfuse -lpthread -ldl
  137. #TOPT_ALL := $(TOPT_wit) $(TOPT_wwt) $(TOPT_wdf) $(TOPT_wfuse)
  138. #---------------
  139. TOBJ_wit := wit-mix.o
  140. TOBJ_wwt :=
  141. TOBJ_wdf :=
  142. TOBJ_wfuse :=
  143. TOBJ_ALL := $(TOBJ_wit) $(TOBJ_wwt) $(TOBJ_wdf) $(TOBJ_wfuse)
  144. #-------------------------------------------------------------------------------
  145. # sub libs
  146. # libbz2 & lzma
  147. LIBBZ2_SRC = $(shell echo src/libbz2/*.c)
  148. LIBBZ2_OBJ = $(patsubst %.c,%.o,$(LIBBZ2_SRC))
  149. LZMA_SRC = $(shell echo src/lzma/*.c)
  150. LZMA_OBJ = $(patsubst %.c,%.o,$(LZMA_SRC))
  151. ifeq ($(SYSTEM),cygwin)
  152. LZMA_FLAGS = -Wno-unused-but-set-variable
  153. BZIP2_FLAGS = -Wno-maybe-uninitialized
  154. else ifeq ($(SYSTEM),mac)
  155. LZMA_FLAGS =
  156. BZIP2_FLAGS =
  157. else
  158. LZMA_FLAGS = -Wno-unused-but-set-variable
  159. BZIP2_FLAGS = -Wno-maybe-uninitialized
  160. endif
  161. # lib summary
  162. LIB_LIST += libbz2 lzma
  163. LIB_OBJECTS += $(LIBBZ2_OBJ) $(LZMA_OBJ)
  164. RM_FILES += $(foreach l,$(LIB_LIST),src/$(l)/*.{d,o})
  165. #-------------------------------------------------------------------------------
  166. # source files
  167. UI_FILES = ui.def
  168. UI_FILES += $(patsubst %,ui-%.c,$(MAIN_TOOLS) $(EXTRA_TOOLS))
  169. UI_FILES += $(patsubst %,ui-%.h,$(MAIN_TOOLS) $(EXTRA_TOOLS))
  170. UI_TABS = $(patsubst %,tab-%.inc,$(MAIN_TOOLS) $(EXTRA_TOOLS))
  171. SETUP_DIR = ./setup
  172. SETUP_INFO = INSTALL.txt
  173. SETUP_FILES = version.h install.sh cygwin-copy.sh wit.def \
  174. $(SETUP_INFO) $(CYGWIN_SCRIPTS)
  175. DIR_LIST += $(SETUP_DIR)
  176. RM_FILES2 += $(SETUP_FILES)
  177. TEXT_DIR = ./text-files
  178. TEXT_FILES = logo.inc ui-head.inc config-paths.inc
  179. DIR_LIST += $(TEXT_DIR)
  180. RM_FILES2 += $(TEXT_FILES)
  181. #-------------------------------------------------------------------------------
  182. # object files
  183. # objects of tools
  184. MAIN_TOOLS_OBJ := $(patsubst %,%.o,$(MAIN_TOOLS) $(EXTRA_TOOLS))
  185. OTHER_TOOLS_OBJ := $(patsubst %,%.o,$(TEST_TOOLS) $(HELPER_TOOLS))
  186. # dclib
  187. DCLIB_DIR := ./dclib
  188. DIR_LIST += $(DCLIB_DIR)
  189. VPATH += $(DCLIB_DIR)
  190. CFLAGS += -I$(DCLIB_DIR)
  191. # other objects
  192. WIT_O := lib-std.o lib-file.o lib-sf.o \
  193. lib-bzip2.o lib-lzma.o lib-dol.o \
  194. lib-wdf.o lib-wia.o lib-ciso.o lib-gcz.o \
  195. iso-interface.o wbfs-interface.o patch.o \
  196. titles.o match-pattern.o dclib-utf8.o \
  197. sha1dgst.o sha1_one.o \
  198. $(DCLIB_O)
  199. LIBWBFS_O := tools.o file-formats.o libwbfs.o wiidisc.o cert.o rijndael.o
  200. ifeq ($(SYSTEM),cygwin)
  201. WIT_O += winapi.o
  202. endif
  203. # object groups
  204. UI_OBJECTS := $(sort $(MAIN_TOOLS_OBJ))
  205. #C_OBJECTS := $(sort $(OTHER_TOOLS_OBJ) $(WIT_O) $(LIBWBFS_O) $(LZMA_O) $(TOBJ_ALL))
  206. C_OBJECTS := $(sort $(OTHER_TOOLS_OBJ) $(WIT_O) $(LIBWBFS_O) $(TOBJ_ALL))
  207. ASM_OBJECTS := ssl-asm.o
  208. # all objects + sources
  209. #ALL_OBJECTS = $(sort $(WIT_O) $(LIBWBFS_O) $(LZMA_O) $(ASM_OBJECTS) $(LIB_OBJECTS))
  210. ALL_OBJECTS = $(sort $(WIT_O) $(LIBWBFS_O) $(ASM_OBJECTS) $(LIB_OBJECTS))
  211. ALL_SOURCES = $(patsubst %.o,%.c,$(UI_OBJECTS) $(C_OBJECTS) $(ASM_OBJECTS))
  212. #-------------------------------------------------------------------------------
  213. SHARE_PATH = $(INSTALL_PATH)/share/wit
  214. INSTALL_SCRIPTS = install.sh load-titles.sh
  215. RM_FILES += $(INSTALL_SCRIPTS)
  216. SCRIPTS = ./scripts
  217. TEMPLATES = ./templates
  218. MODULES = $(TEMPLATES)/module
  219. GEN_TEMPLATE = ./gen-template.sh
  220. GEN_TEXT_FILE = ./gen-text-file.sh
  221. UI = ./src/ui
  222. DIR_LIST += $(SCRIPTS) $(TEMPLATES) $(MODULES)
  223. #VPATH += src src/libwbfs src/lzma src/crypto $(UI) work
  224. #DIR_LIST += src src/libwbfs src/lzma src/crypto $(UI) work
  225. VPATH += src src/libwbfs src/crypto $(UI) work
  226. DIR_LIST += src src/libwbfs src/crypto $(UI) work
  227. DEFINES1 += -DLARGE_FILES -D_FILE_OFFSET_BITS=64
  228. DEFINES1 += -DWIT # compile wit tools (for shared sources (e.g. libwbfs))
  229. DEFINES1 += -DDEBUG_ASSERT # enable ASSERTions in release version too
  230. DEFINES1 += -DEXTENDED_ERRORS=1 # enable extended error messages (function,line,file)
  231. DEFINES1 += -D_7ZIP_ST=1 # disable 7zip multi threading
  232. DEFINES1 += -D_LZMA_PROB32=1 # LZMA option
  233. DEFINES = $(strip $(DEFINES1) $(MODE) $(XDEF))
  234. CFLAGS += -std=gnu99 -fomit-frame-pointer -fno-strict-aliasing -funroll-loops
  235. CFLAGS += -Wall -Wno-parentheses -Wno-unused-function
  236. #CFLAGS += -O3 -Isrc/libwbfs -Isrc/lzma -Isrc -I$(UI) -I. -Iwork
  237. CFLAGS += -O3 -Isrc/libwbfs -Isrc -I$(UI) -I. -Iwork
  238. ifeq ($(SYSTEM_LINUX),1)
  239. LIBS += -ltinfo
  240. CFLAGS += -Wno-format-truncation
  241. endif
  242. ifeq ($(SYSTEM),cygwin)
  243. CFLAGS += -Wno-format-truncation
  244. endif
  245. ifeq ($(SYSTEM),mac)
  246. CFLAGS += -I/usr/local/include
  247. else
  248. LDFLAGS += -static-libgcc
  249. endif
  250. ifeq ($(shell expr $(GCC_VERSION) '>=' 7.0 ),1)
  251. CFLAGS += -Wno-format-truncation
  252. endif
  253. CFLAGS += $(XFLAGS)
  254. CFLAGS := $(strip $(CFLAGS))
  255. DEPFLAGS += -MMD
  256. #--- system depedent flags & libs
  257. LDFLAGS := $(strip $(LDFLAGS))
  258. ifeq ($(HAVE_ZLIB),1)
  259. LIBS += -lz
  260. endif
  261. LIBS += -lm -lncurses $(XLIBS)
  262. ifeq ($(HAVE_SHA),1)
  263. ifeq ($(SYSTEM_LINUX),1)
  264. ifneq ($(STATIC),1)
  265. DEFINES1 += -DUSE_SHA_LIB
  266. LIBS += -lcrypto
  267. endif
  268. else ifeq ($(SYSTEM),cygwin)
  269. DEFINES1 += -DUSE_SHA_LIB
  270. LIBS += -lcrypto
  271. endif
  272. endif
  273. #-------------------------------------------------------------------------------
  274. DISTRIB_RM = ./wit-v$(VERSION)-r
  275. DISTRIB_BASE = wit-v$(VERSION)-r$(REVISION_NEXT)
  276. DISTRIB_PATH = ./$(DISTRIB_BASE)-$(SYSTEM2)
  277. DISTRIB_I386 = $(DISTRIB_BASE)-i386.tar.gz
  278. DISTRIB_X86_64 = $(DISTRIB_BASE)-x86_64.tar.gz
  279. DISTRIB_MAC = $(DISTRIB_BASE)-mac.tar.gz
  280. DISTRIB_CYGWIN32 = $(DISTRIB_BASE)-cygwin32.zip
  281. DISTRIB_CYGWIN64 = $(DISTRIB_BASE)-cygwin64.zip
  282. DISTRIB_FILES = gpl-2.0.txt $(INSTALL_SCRIPTS) $(SETUP_INFO)
  283. DOC_FILES = doc/*.txt
  284. IGNORE_DOC_FILES= HISTORY-v*.txt
  285. TITLE_FILES = titles.txt $(patsubst %,titles-%.txt,$(LANGUAGES))
  286. LANGUAGES = de es fr it ja ko nl pt ru zhcn zhtw
  287. BIN_FILES = $(MAIN_TOOLS) $(EXTRA_TOOLS)
  288. SHARE_FILES = $(TITLE_FILES) system-menu.txt magic.txt
  289. CYGWIN_DIR = /usr/bin
  290. CYGWIN_TOOLS = bash cp diff env grep mkdir mv realpath regtool rm stat tr wget
  291. CYGWIN_SCRIPTS = load-titles.sh load-titles.bat \
  292. windows-install.sh windows-uninstall.sh
  293. CYGWIN_INSTALLER= $(SETUP_DIR)/windows-install.exe
  294. WIN_INSTALL_PATH= Wiimm/WIT
  295. DIR_LIST_BIN = $(SCRIPTS) bin
  296. DIR_LIST += $(DIR_LIST_BIN)
  297. DIR_LIST += share work pool makefiles-local edit-list
  298. #-------------------------------------------------------------------------------
  299. # sub projects
  300. SUB_PROJECTS += test-libwbfs
  301. RM_FILES += $(foreach p,$(SUB_PROJECTS),$(p)/*.{d,o} $(p)/$(p))
  302. #
  303. ###############################################################################
  304. # default rule
  305. default_rule: all
  306. @echo "HINT: try 'make help'"
  307. # include this behind the default rule
  308. -include $(ALL_SOURCES:.c=.d)
  309. #
  310. ###############################################################################
  311. # general rules
  312. $(ALL_TOOLS_X): %: %.o $(ALL_OBJECTS) $(TOBJ_ALL) Makefile | $(HELPER_TOOLS)
  313. @printf "$(LOGFORMAT_TOOL)" tool "$@" "$(MODE) $(TOPT_$@) $(TOBJ_$@)"
  314. @$(CC) $(CFLAGS) $(DEFINES) $(LDFLAGS) $@.o \
  315. $(ALL_OBJECTS) $(TOBJ_$@) $(LIBS) $(TOPT_$@) -o $@
  316. @if test -f $@.exe; then $(STRIP) $@.exe; else $(STRIP) $@; fi
  317. @mkdir -p bin/$(SYSTEM2) bin/$(SYSTEM2)/debug
  318. @if test -s $(MODE_FILE) && grep -Fq -e -DDEBUG $(MODE_FILE); \
  319. then cp -p $@ bin/$(SYSTEM2)/debug/; \
  320. else cp -p $@ bin/; cp -p $@ bin/$(SYSTEM2)/; fi
  321. #--------------------------
  322. $(HELPER_TOOLS): %: %.o $(ALL_OBJECTS) $(UI_TABS) Makefile
  323. @printf "$(LOGFORMAT_TOOL)" helper "$@ $(TOBJ_$@)" "$(MODE)"
  324. @$(CC) $(CFLAGS) $(DEFINES) $(LDFLAGS) $@.o \
  325. $(ALL_OBJECTS) $(TOBJ_$@) $(LIBS) -o $@
  326. #--------------------------
  327. $(WDF_LINKS): wdf
  328. @printf "$(LOGFORMAT_INST)" "link" "wdf -> $@" ""
  329. @ln -f wdf "$@"
  330. #--------------------------
  331. $(UI_OBJECTS): %.o: %.c ui-%.c ui-%.h version.h Makefile
  332. @printf "$(LOGFORMAT_CC)" +object "$@" "$(MODE)"
  333. @$(CC) $(CFLAGS) $(DEPFLAGS) $(DEFINES) -c $< -o $@
  334. #--------------------------
  335. $(C_OBJECTS): %.o: %.c version.h Makefile $(TEXT_FILES)
  336. @printf "$(LOGFORMAT_CC)" object "$@" "$(MODE)"
  337. @$(CC) $(CFLAGS) $(DEPFLAGS) $(DEFINES) -c $< -o $@
  338. #--------------------------
  339. $(ASM_OBJECTS): %.o: %.S Makefile
  340. @printf "$(LOGFORMAT_CC)" asm "$@" "$(MODE)"
  341. @$(CC) $(CFLAGS) $(DEPFLAGS) $(DEFINES) -c $< -o $@
  342. #--------------------------
  343. $(SETUP_FILES): templates.sed $(SETUP_DIR)/$@
  344. @printf "$(LOGFORMAT)" create "$@" ""
  345. @chmod 775 $(GEN_TEMPLATE)
  346. @$(GEN_TEMPLATE) $@
  347. #--------------------------
  348. $(TEXT_FILES): $(GEN_TEXT_FILE) $(TEXT_DIR)/$@
  349. @printf "$(LOGFORMAT)" text "$@" ""
  350. @chmod 775 $(GEN_TEXT_FILE)
  351. @$(GEN_TEXT_FILE) $(TEXT_DIR) $@
  352. #--------------------------
  353. $(UI_FILES): gen-ui.c ui.h $(UI_TABS) | gen-ui
  354. @printf "$(LOGFORMAT)" run gen-ui ""
  355. @./gen-ui
  356. .PHONY : ui
  357. ui : gen-ui
  358. @printf "$(LOGFORMAT)" run gen-ui ""
  359. @./gen-ui
  360. #
  361. ###############################################################################
  362. # lib specific rules
  363. $(LIBBZ2_OBJ): %.o: %.c Makefile
  364. @printf "$(LOGFORMAT_CC)" object "$(subst src/libbz2/,,$@)" "$(MODE) [libbz2]"
  365. @$(CC) $(CFLAGS) $(DEPFLAGS) $(BZIP2_FLAGS) $(DEFINES) -c $< -o $@
  366. $(LZMA_OBJ): %.o: %.c Makefile
  367. @printf "$(LOGFORMAT_CC)" object "$(subst src/lzma/,,$@)" "$(MODE) [lzma]"
  368. @$(CC) $(CFLAGS) $(DEPFLAGS) $(LZMA_FLAGS) $(DEFINES) -c $< -o $@
  369. #
  370. ###############################################################################
  371. # specific rules in alphabetic order
  372. .PHONY : all
  373. all: $(HELPER_TOOLS) $(ALL_TOOLS) $(WDF_LINKS) $(INSTALL_SCRIPTS) $(SETUP_INFO)
  374. .PHONY : all+
  375. all+: clean+ all distrib
  376. .PHONY : all++
  377. all++: clean+ all titles distrib
  378. #
  379. #--------------------------
  380. .PHONY : ch+
  381. ch+: chmod chown chgrp
  382. #
  383. #--------------------------
  384. .PHONY : chmod
  385. chmod:
  386. @printf "$(LOGFORMAT)" chmod 775/664 ""
  387. @for d in . $(DIR_LIST); do test -d "$$d" && chmod ug+rw "$$d"/*; done
  388. @for d in $(DIR_LIST); do test -d "$$d" && chmod 775 "$$d"; done
  389. @find . -name '*.sh' -exec chmod 775 {} +
  390. @for t in $(ALL_TOOLS_X); do test -f "$$t" && chmod 775 "$$t"; done || true
  391. @chmod 664 src/*.[hc] src/*/*.[hc] dclib/*.[hc]
  392. #
  393. #--------------------------
  394. .PHONY : chown
  395. chown:
  396. @printf "$(LOGFORMAT)" chown "-R $$( stat -c%u . 2>/dev/null || stat -f%u . ) ." ""
  397. @chown -R "$$( stat -c%u . 2>/dev/null || stat -f%u . )" .
  398. #
  399. #--------------------------
  400. .PHONY : chgrp
  401. chgrp:
  402. @printf "$(LOGFORMAT)" chgrp "-R $$( stat -c%g . 2>/dev/null || stat -f%g . ) ." ""
  403. @chgrp -R "$$( stat -c%g . 2>/dev/null || stat -f%g . )" .
  404. #
  405. #--------------------------
  406. .PHONY : clean
  407. clean:
  408. @printf "$(LOGFORMAT)" rm "output files + distrib" ""
  409. @rm -f $(RM_FILES)
  410. @rm -fr $(DISTRIB_RM)*
  411. @cd dclib && rm -f $(DCLIB_PRIVATE)
  412. .PHONY : c+ clean+
  413. c+ clean+: clean
  414. @printf "$(LOGFORMAT)" rm "test files + template output" ""
  415. @rm -f $(RM_FILES2)
  416. -@rm -fr doc
  417. .PHONY : c++ clean++
  418. c++ clean++: clean+
  419. @test -d .svn && svn st | sort -k2 || true
  420. #
  421. #--------------------------
  422. .PHONY : debug
  423. debug:
  424. @printf "$(LOGFORMAT)" enable debug "-> define -DDEBUG"
  425. @rm -f *.o $(ALL_TOOLS_X)
  426. @echo "-DDEBUG" >>$(MODE_FILE)
  427. @sort $(MODE_FILE) | uniq > $(MODE_FILE).tmp
  428. # 2 steps to bypass a cygwin mv failure
  429. @cp $(MODE_FILE).tmp $(MODE_FILE)
  430. @rm -f $(MODE_FILE).tmp
  431. #
  432. #--------------------------
  433. .PHONY : distrib2
  434. distrib2:
  435. ifeq ($(SYSTEM_LINUX),1)
  436. @printf "\n---------- BUILDING LINUX/I386 ----------\n\n"
  437. @for t in $(ALL_TOOLS_X); do rm -f bin/$$t; done
  438. @M32=1 $(MAKE) --no-print-directory clean+ distrib
  439. @mv "$(DISTRIB_I386)" "save-$(DISTRIB_I386)"
  440. @printf "\n---------- BUILDING LINUX/X86_64 ----------\n\n"
  441. @for t in $(ALL_TOOLS_X); do rm -f bin/$$t; done
  442. @$(MAKE) --no-print-directory clean+ distrib
  443. @mv "save-$(DISTRIB_I386)" "$(DISTRIB_I386)"
  444. else
  445. @$(MAKE) --no-print-directory clean+ distrib
  446. endif
  447. #-----
  448. .PHONY : distrib
  449. distrib:
  450. ifeq ($(SYSTEM),mac)
  451. @$(MAKE) --no-print-directory mac-distrib
  452. else ifeq ($(SYSTEM),cygwin)
  453. $(MAKE) --no-print-directory all doc cygwin-copy.sh \
  454. $(CYGWIN_SCRIPTS) gen-distrib wit.def
  455. else
  456. @STATIC=1 $(MAKE) --no-print-directory all doc gen-distrib wit.def
  457. endif
  458. #-----
  459. .PHONY : gen-distrib
  460. gen-distrib:
  461. @printf "$(LOGFORMAT)" create "$(DISTRIB_PATH)" ""
  462. ifeq ($(SYSTEM),cygwin)
  463. @rm -rf $(DISTRIB_PATH)/* 2>/dev/null || true
  464. @rm -rf $(DISTRIB_PATH) 2>/dev/null || true
  465. @mkdir -p $(DISTRIB_PATH)/bin $(DISTRIB_PATH)/doc
  466. @./cygwin-copy.sh
  467. @printf '@cmd\r\n' >$(DISTRIB_PATH)/bin/wit-console.bat
  468. @cp -p gpl-2.0.txt $(SETUP_INFO) $(DISTRIB_PATH)
  469. @ln -f $(MAIN_TOOLS) $(WDF_LINKS) $(CYGWIN_SCRIPTS) $(DISTRIB_PATH)/bin
  470. @ln -f $(CYGWIN_INSTALLER) $(DISTRIB_PATH)/windows-install.exe
  471. @ln -f $(CYGWIN_INSTALLER) $(DISTRIB_PATH)/windows-uninstall.exe
  472. @ln -f $(CYGWIN_INSTALLER) $(DISTRIB_PATH)/bin/windows-install.exe
  473. @ln -f $(CYGWIN_INSTALLER) $(DISTRIB_PATH)/bin/windows-uninstall.exe
  474. @( cd share; cp $(SHARE_FILES) ../$(DISTRIB_PATH)/bin )
  475. @cp -p $(DOC_FILES) $(DISTRIB_PATH)/doc
  476. @rm -f $(DISTRIB_PATH)/doc/$(IGNORE_DOC_FILES)
  477. @zip -roq $(DISTRIB_PATH).zip $(DISTRIB_PATH)
  478. @chmod 664 $(DISTRIB_PATH).zip
  479. else
  480. @rm -rf $(DISTRIB_PATH)
  481. @mkdir -p $(DISTRIB_PATH)/bin $(DISTRIB_PATH)/scripts
  482. @mkdir -p $(DISTRIB_PATH)/share $(DISTRIB_PATH)/doc
  483. @cp -p $(DISTRIB_FILES) $(DISTRIB_PATH)
  484. @ln -f $(MAIN_TOOLS) $(WDF_LINKS) $(DISTRIB_PATH)/bin
  485. @for t in $(EXTRA_TOOLS); do [[ -f bin/$(SYSTEM)/$$t ]] \
  486. && ln -f bin/$(SYSTEM)/$$t $(DISTRIB_PATH)/bin; done || true
  487. @cp -p share/*.txt $(DISTRIB_PATH)/share
  488. @cp -p $(DOC_FILES) $(DISTRIB_PATH)/doc
  489. @rm -f $(DISTRIB_PATH)/doc/$(IGNORE_DOC_FILES)
  490. @cp -p $(SCRIPTS)/*.{sh,txt} $(DISTRIB_PATH)/scripts
  491. @chmod -R 664 $(DISTRIB_PATH)
  492. @chmod a+x $(DISTRIB_PATH)/*.sh $(DISTRIB_PATH)/scripts/*.sh $(DISTRIB_PATH)/bin*/*
  493. @chmod -R a+X $(DISTRIB_PATH)
  494. @tar -czf $(DISTRIB_PATH).tar.gz $(DISTRIB_PATH)
  495. @chmod 664 $(DISTRIB_PATH).tar.gz
  496. endif
  497. #-----
  498. .PHONY : copy-distrib
  499. copy-distrib: distrib2
  500. @printf "$(LOGFORMAT)" copy "$(DISTRIB_BASE).*" "-> $(DOWNLOAD_DIR)"
  501. @[[ -s "$(DISTRIB_I386)" ]] \
  502. && cp --preserve=time "$(DISTRIB_I386)" "$(DOWNLOAD_DIR)" \
  503. || true
  504. @[[ -s "$(DISTRIB_X86_64)" ]] \
  505. && cp --preserve=time "$(DISTRIB_X86_64)" "$(DOWNLOAD_DIR)" \
  506. || true
  507. @[[ -s "$(DISTRIB_CYGWIN32)" ]] \
  508. && cp --preserve=time "$(DISTRIB_CYGWIN32)" "$(DOWNLOAD_DIR)" \
  509. || true
  510. @[[ -s "$(DISTRIB_CYGWIN64)" ]] \
  511. && cp --preserve=time "$(DISTRIB_CYGWIN64)" "$(DOWNLOAD_DIR)" \
  512. || true
  513. #
  514. #--------------------------
  515. .PHONY : doc
  516. doc: $(MAIN_TOOLS) templates.sed gen-doc
  517. .PHONY : gen-doc
  518. gen-doc:
  519. @printf "$(LOGFORMAT)" create documentation ""
  520. @chmod ug+x $(GEN_TEMPLATE)
  521. @$(GEN_TEMPLATE)
  522. #
  523. #--------------------------
  524. .PHONY : flags
  525. flags:
  526. @echo ""
  527. @echo "DEFINES: $(DEFINES)"
  528. @echo ""
  529. @echo "CFLAGS: $(CFLAGS)"
  530. @echo ""
  531. @echo "LDFLAGS: $(LDFLAGS)"
  532. @echo ""
  533. @echo "LIBS: $(LIBS)"
  534. @echo ""
  535. @echo "LIBBZ2_OBJ: $(LIBBZ2_OBJ)"
  536. @echo ""
  537. @echo "LZMA_OBJ: $(LZMA_OBJ)"
  538. @echo ""
  539. @echo "C_OBJECTS: $(C_OBJECTS)"
  540. @echo ""
  541. #
  542. #--------------------------
  543. .PHONY : install
  544. install: all
  545. ifeq ($(SYSTEM),cygwin)
  546. @[[ -d $(DISTRIB_PATH)/bin ]] || make distrib
  547. @( cd "$(DISTRIB_PATH)/bin" && ./windows-install.sh --cygwin )
  548. else
  549. @chmod a+x install.sh
  550. @./install.sh --make
  551. endif
  552. .PHONY : install+
  553. install+: clean+ all
  554. @chmod a+x install.sh
  555. @./install.sh --make
  556. #--------------------------
  557. .PHONY : install2
  558. install2:
  559. ifeq ($(SYSTEM_LINUX),1)
  560. @printf "\n---------- BUILDING LINUX/I386 ----------\n\n"
  561. @for t in $(ALL_TOOLS_X); do rm -f bin/$$t; done
  562. @$(MAKE) --no-print-directory clean+
  563. @M32=1 $(MAKE) -j --no-print-directory install
  564. ifeq ($(HAVE_INSTBIN_32),1)
  565. @printf "$(LOGFORMAT_INST)" copy "$(INSTBIN)/* to $(INSTBIN_32)"
  566. @for f in $(BIN_FILES); do [[ -f $(INSTBIN)/$$f ]] \
  567. && cp -p $(INSTBIN)/$$f $(INSTBIN_32); done; true
  568. @for f in $(WDF_LINKS); do ln -f $(INSTBIN_32)/wdf $(INSTBIN_32)/$$f; done
  569. endif
  570. @printf "\n---------- BUILDING LINUX/X86_64 ----------\n\n"
  571. @for t in $(ALL_TOOLS_X); do rm -f bin/$$t; done
  572. @$(MAKE) --no-print-directory clean+
  573. @$(MAKE) -j --no-print-directory install
  574. ifeq ($(HAVE_INSTBIN_64),1)
  575. @printf "$(LOGFORMAT_INST)" copy "$(INSTBIN)/* to $(INSTBIN_64)"
  576. @for f in $(BIN_FILES); do [[ -f $(INSTBIN)/$$f ]] \
  577. && cp -p $(INSTBIN)/$$f $(INSTBIN_64); done; true
  578. @for f in $(WDF_LINKS); do ln -f $(INSTBIN_64)/wdf $(INSTBIN_64)/$$f; done
  579. endif
  580. else
  581. @$(MAKE) --no-print-directory clean+ install
  582. endif
  583. #
  584. #--------------------------
  585. .PHONY : new
  586. new:
  587. @printf "$(LOGFORMAT)" enable new "-> define -DNEW_FEATURES"
  588. @rm -f *.o $(ALL_TOOLS_X)
  589. @echo "-DNEW_FEATURES" >>$(MODE_FILE)
  590. @sort $(MODE_FILE) | uniq > $(MODE_FILE).tmp
  591. # 2 steps to bypass a cygwin mv failure
  592. @cp $(MODE_FILE).tmp $(MODE_FILE)
  593. @rm -f $(MODE_FILE).tmp
  594. #
  595. #--------------------------
  596. .PHONY : old
  597. old:
  598. @printf "$(LOGFORMAT)" enable old "-> define -DOLD_FEATURES"
  599. @rm -f *.o $(ALL_TOOLS_X)
  600. @echo "-DOLD_FEATURES" >>$(MODE_FILE)
  601. @sort $(MODE_FILE) | uniq > $(MODE_FILE).tmp
  602. # 2 steps to bypass a cygwin mv failure
  603. @cp $(MODE_FILE).tmp $(MODE_FILE)
  604. @rm -f $(MODE_FILE).tmp
  605. #
  606. #--------------------------
  607. .PHONY : predef
  608. predef:
  609. @gcc -E -dM none.c | sort
  610. #
  611. #--------------------------
  612. .PHONY : $(SUB_PROJECTS)
  613. $(SUB_PROJECTS):
  614. @printf "$(LOGFORMAT)" make "$@" ""
  615. @$(MAKE) -C "$@"
  616. #
  617. #--------------------------
  618. templates.sed: Makefile
  619. @printf "$(LOGFORMAT)" create templates.sed ""
  620. @printf '%s\n' \
  621. '/^~/ d;' \
  622. 's|@.@@@|$(VERSION_NUM)|g;' \
  623. 's|@@@@-@@-@@|$(DATE)|g;' \
  624. 's|@@:@@:@@|$(TIME)|g;' \
  625. 's|@@AUTHOR@@|$(AUTHOR)|g;' \
  626. 's|@@SYSTEM@@|$(SYSTEM)|g;' \
  627. 's|@@SYSTEM2@@|$(SYSTEM2)|g;' \
  628. 's|@@TOOLSET-SHORT@@|$(TOOLSET_SHORT)|g;' \
  629. 's|@@TOOLSET-LONG@@|$(TOOLSET_LONG)|g;' \
  630. 's|@@WIT-SHORT@@|$(WIT_SHORT)|g;' \
  631. 's|@@WIT-LONG@@|$(WIT_LONG)|g;' \
  632. 's|@@WWT-SHORT@@|$(WWT_SHORT)|g;' \
  633. 's|@@WWT-LONG@@|$(WWT_LONG)|g;' \
  634. 's|@@WDF-SHORT@@|$(WDF_SHORT)|g;' \
  635. 's|@@WDF-LONG@@|$(WDF_LONG)|g;' \
  636. 's|@@WFUSE-SHORT@@|$(WFUSE_SHORT)|g;' \
  637. 's|@@WFUSE-LONG@@|$(WFUSE_LONG)|g;' \
  638. 's|@@VERSION@@|$(VERSION)|g;' \
  639. 's|@@VERSION-NUM@@|$(VERSION_NUM)|g;' \
  640. 's|@@BETA-VERSION@@|$(BETA_VERSION)|g;' \
  641. 's|@@BETA-SUFFIX@@|$(BETA_SUFFIX)|g;' \
  642. 's|@@REV@@|$(REVISION)|g;' \
  643. 's|@@REV-NUM@@|$(REVISION_NUM)|g;' \
  644. 's|@@REV-NEXT@@|$(REVISION_NEXT)|g;' \
  645. 's|@@BINTIME@@|$(BINTIME)|g;' \
  646. 's|@@DATE@@|$(DATE)|g;' \
  647. 's|@@TIME@@|$(TIME)|g;' \
  648. 's|@@INSTALL-PATH@@|$(INSTALL_PATH)|g;' \
  649. 's|@@SHARE-PATH@@|$(SHARE_PATH)|g;' \
  650. 's|@@BIN-FILES@@|$(BIN_FILES)|g;' \
  651. 's|@@SHARE-FILES@@|$(SHARE_FILES)|g;' \
  652. 's|@@WDF-LINKS@@|$(WDF_LINKS)|g;' \
  653. 's|@@CYGWIN-DIR@@|$(CYGWIN_DIR)|g;' \
  654. 's|@@CYGWIN-TOOLS@@|$(CYGWIN_TOOLS)|g;' \
  655. 's|@@WIN-INSTALL-PATH@@|$(WIN_INSTALL_PATH)|g;' \
  656. 's|@@LANGUAGES@@|$(LANGUAGES)|g;' \
  657. 's|@@DISTRIB-PATH@@|$(DISTRIB_PATH)|g;' \
  658. 's|@@DISTRIB-I386@@|$(DISTRIB_I386)|g;' \
  659. 's|@@DISTRIB-X86_64@@|$(DISTRIB_X86_64)|g;' \
  660. 's|@@DISTRIB-MAC@@|$(DISTRIB_MAC)|g;' \
  661. 's|@@DISTRIB-CYGWIN32@@|$(DISTRIB_CYGWIN64)|g;' \
  662. 's|@@DISTRIB-CYGWIN64@@|$(DISTRIB_CYGWIN32)|g;' \
  663. 's|@@URI-FILE@@|$(URI_FILE)|g;' \
  664. 's|@@URI-REPOS@@|$(URI_REPOS)|g;' \
  665. 's|@@URI-VIEWVC@@|$(URI_VIEWVC)|g;' \
  666. 's|@@URI-HOME@@|$(URI_HOME)|g;' \
  667. 's|@@URI-DOWNLOAD@@|$(URI_DOWNLOAD)|g;' \
  668. 's|@@URI-WDF@@|$(URI_WDF)|g;' \
  669. 's|@@URI-CISO@@|$(URI_CISO)|g;' \
  670. 's|@@URI-QTWITGUI@@|$(URI_QTWITGUI)|g;' \
  671. 's|@@URI-WIIBAFU@@|$(URI_WIIBAFU)|g;' \
  672. 's|@@URI-MACWITGUI@@|$(URI_MACWITGUI)|g;' \
  673. 's|@@URI-GBATEMP@@|$(URI_GBATEMP)|g;' \
  674. 's|@@URI-DOWNLOAD-I386@@|$(URI_DOWNLOAD_I386)|g;' \
  675. 's|@@URI-DOWNLOAD-X86_64@@|$(URI_DOWNLOAD_X86_64)|g;' \
  676. 's|@@URI-DOWNLOAD-MAC@@|$(URI_DOWNLOAD_MAC)|g;' \
  677. 's|@@URI-DOWNLOAD-CYGWIN@@|$(URI_DOWNLOAD_CYGWIN)|g;' \
  678. 's|@@URI-TITLES@@|$(URI_TITLES)|g;' \
  679. >templates.sed
  680. #
  681. #--------------------------
  682. .PHONY : test
  683. test:
  684. @printf "$(LOGFORMAT)" enable test "-> define -DTEST"
  685. @rm -f *.o $(ALL_TOOLS_X)
  686. @echo "-DTEST" >>$(MODE_FILE)
  687. @sort $(MODE_FILE) | uniq > $(MODE_FILE).tmp
  688. # 2 steps to bypass a cygwin mv failure
  689. @cp $(MODE_FILE).tmp $(MODE_FILE)
  690. @rm -f $(MODE_FILE).tmp
  691. #
  692. #--------------------------
  693. .PHONY : test-trace
  694. test-trace:
  695. @printf "$(LOGFORMAT)" enable testtrace "-> define -DTESTTRACE"
  696. @rm -f *.o $(ALL_TOOLS_X)
  697. @echo "-DTESTTRACE" >>$(MODE_FILE)
  698. @sort $(MODE_FILE) | uniq > $(MODE_FILE).tmp
  699. # 2 steps to bypass a cygwin mv failure
  700. @cp $(MODE_FILE).tmp $(MODE_FILE)
  701. @rm -f $(MODE_FILE).tmp
  702. #
  703. #--------------------------
  704. .PHONY : titles
  705. titles: wit load-titles.sh gen-titles
  706. .PHONY : gen-titles
  707. gen-titles:
  708. @chmod a+x load-titles.sh
  709. @./load-titles.sh --make
  710. #
  711. #--------------------------
  712. .PHONY : tools
  713. tools: $(ALL_TOOLS)
  714. #
  715. #--------------------------
  716. .PHONY : up
  717. up: clean++ do_up ch+
  718. .PHONY : do_up
  719. do_up: clean
  720. @printf "$(LOGFORMAT)" svn update
  721. @svn update
  722. #
  723. #--------------------------
  724. .PHONY : wait
  725. wait:
  726. @printf "$(LOGFORMAT)" enable wait "-> define -DWAIT_ENABLED"
  727. @rm -f *.o $(ALL_TOOLS_X)
  728. @echo "-DWAIT_ENABLED" >>$(MODE_FILE)
  729. @sort $(MODE_FILE) | uniq > $(MODE_FILE).tmp
  730. # 2 steps to bypass a cygwin mv failure
  731. @cp $(MODE_FILE).tmp $(MODE_FILE)
  732. @rm -f $(MODE_FILE).tmp
  733. #
  734. #--------------------------
  735. %.wbfs: wwt
  736. @printf "$(LOGFORMAT)" create "$@" "$(WBFS_SIZE)G, add smallest $(WBFS_COUNT) ISOs"
  737. @rm -f $@
  738. @./wwt format --force --inode --size $(WBFS_SIZE)- "$@"
  739. @stat --format="%b|%n" pool/wdf/*.wdf \
  740. | sort -n \
  741. | awk '-F|' '{print $$2}' \
  742. | head -n$(WBFS_COUNT) \
  743. | ./wwt -A -p "$@" add @- -v
  744. #
  745. #--------------------------
  746. .PHONY : format-wbfs
  747. format-wbfs:
  748. @printf "$(LOGFORMAT)" create "$(WBFS_FILES)," "size=$(WBFS_SIZE)G"
  749. @rm -f $(WBFS_FILES)
  750. @s=512; \
  751. for w in $(WBFS_FILES); \
  752. do ./wwt format -qfs $(WBFS_SIZE)- --sector-size=$$s --inode "$$w"; \
  753. let s*=2; \
  754. done
  755. #
  756. #--------------------------
  757. .PHONY : wbfs
  758. wbfs: wwt format-wbfs gen-wbfs
  759. .PHONY : gen-wbfs
  760. gen-wbfs: format-wbfs
  761. @printf "$(LOGFORMAT)" charge "$(WBFS_FILE)" ""
  762. @stat --format="%b|%n" pool/wdf/*.wdf \
  763. | sort -n \
  764. | awk '-F|' '{print $$2}' \
  765. | head -n$(WBFS_COUNT) \
  766. | ./wwt -A -p @<(ls $(WBFS_FILE)) add @-
  767. @echo
  768. @./wwt f -l $(WBFS_FILES)
  769. @./wwt lf $(WBFS_FILE) --mtime
  770. #
  771. #--------------------------
  772. .PHONY : wbfs+
  773. wbfs+: wwt format-wbfs gen-wbfs+
  774. .PHONY : gen-wbfs+
  775. gen-wbfs+: format-wbfs
  776. @printf "$(LOGFORMAT)" charge "$(WBFS_FILES)" ""
  777. @stat --format="%b|%n" pool/iso/*.iso \
  778. | sort -n \
  779. | awk '-F|' '{print $$2}' \
  780. | head -n$(WBFS_COUNT) \
  781. | ./wwt -A -p @<(ls $(WBFS_FILES)) add @-
  782. @echo
  783. @./wwt f -l $(WBFS_FILES)
  784. @./wwt lf $(WBFS_FILES)
  785. @echo "WBFS: this is not a wbfs file" >no.wbfs
  786. #
  787. #--------------------------
  788. .PHONY : xwbfs
  789. xwbfs: wwt
  790. @printf "$(LOGFORMAT)" create x.wbfs "1TB, sec-size=2048 and then with sec-size=512"
  791. @./wwt init -qfs1t x.wbfs --inode --sector-size=2048
  792. @sleep 2
  793. @./wwt init -qfs1t x.wbfs --inode --sector-size=512
  794. #--------------------------
  795. .PHONY : bad-wbfs
  796. bad-wbfs: wwt a.wbfs
  797. @printf "$(LOGFORMAT)" edit "a.wbfs" "(create errors)"
  798. # @./wwt edit -p a.wbfs -f rm=10 act=0
  799. @./wwt edit -p a.wbfs -f free=4 act=0-1 R64P01=10:1
  800. # @./wwt check -p a.wbfs -vv
  801. #
  802. #--------------------------
  803. .PHONY : wdf-links
  804. wdf-links:
  805. @printf "$(LOGFORMAT)" link "$(WDF_TEST_LINKS) -> wdf" ""
  806. @for l in $(WDF_TEST_LINKS); do rm -f $$l; ln -s wdf $$l; done
  807. #
  808. ###############################################################################
  809. # help rule
  810. .PHONY : help
  811. help:
  812. @echo ""
  813. @echo "$(DATE) $(TIME) - $(VERSION) - svn r$(REVISION):$(REVISION_NEXT)"
  814. @echo ""
  815. @echo " make := make all"
  816. @echo " make all make all tools and install scripts"
  817. @echo " make all+ := make clean+ all distrib"
  818. @echo " make all++ := make clean+ all titles distrib"
  819. @echo " make _tool_ compile only the named '_tool_' (wit,wwt,...)"
  820. @echo " make tools make all tools"
  821. @echo ""
  822. @echo " make clean remove all output files"
  823. @echo " make clean+ make clean & rm test_files & rm template_output"
  824. @echo ""
  825. @echo " make debug enable '-DDEBUG'"
  826. @echo " make test enable '-DTEST'"
  827. @echo " make new enable '-DNEW_FEATURES'"
  828. @echo " make old enable '-DOLD_FEATURES'"
  829. @echo " make wait enable '-DWAIT'"
  830. @echo " make testtrace enable '-DTESTTRACE'"
  831. @echo " make flags print DEFINES, CFLAGS and LDFLAGS"
  832. @echo ""
  833. @echo " make doc generate doc files from their templates"
  834. @echo " make distrib make all & build $(DISTRIB_PATH)"
  835. @echo " make titles get titles from $(URI_TITLES)"
  836. @echo " make install make all & copy tools to $(INSTALL_PATH)"
  837. @echo " make install+ := make clean+ install"
  838. @echo ""
  839. @echo " make chmod change mode 775/644 for known dirs and files"
  840. @echo " make chown change owner of all dirs+files to owner of ."
  841. @echo " make chgrp change group of all dirs+files to group of ."
  842. @echo " make ch+ := make chmod chown chgrp"
  843. @echo ""
  844. @echo " make %.wbfs gen %.wbfs, $(WBFS_SIZE)G, add smallest $(WBFS_COUNT) ISOs"
  845. @echo " make wbfs gen $(WBFS_FILE), $(WBFS_SIZE)G, add smallest $(WBFS_COUNT) ISOs"
  846. @echo " make wbfs+ gen $(WBFS_FILES), $(WBFS_SIZE)G, add smallest $(WBFS_COUNT) ISOs"
  847. @echo ""
  848. @echo " make help print this help"
  849. @echo ""
  850. @echo "-------------------------------------------------------------------------------"
  851. @awk -F: '/^.PHONY/ { gsub(/[[:blank:]]*/,"",$$2); print $$2}' $(MYMAKE) \
  852. | sort | pr -5T -w80
  853. @echo "-------------------------------------------------------------------------------"
  854. #
  855. ###############################################################################
  856. # local definitions
  857. -include makefiles-local/Makefile.local.$(SYSTEM)
  858. -include Makefile.user