-
Notifications
You must be signed in to change notification settings - Fork 11
/
template.Makefile
63 lines (41 loc) · 1.61 KB
/
template.Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
IBTOOL=/Applications/Xcode.app/Contents/Developer/usr/bin/ibtool
#this one must be ahead of EXPAND since FILES will be defined
DESTROOT = results
define EXPAND
FILES := $$(filter-out .git,$$(filter-out .svn, $$(filter-out English.lproj, $$(filter-out $(DESTROOT),$$(wildcard $(1)*)))))
DIRS :=
$$(foreach e, $$(FILES), $$(if $$(wildcard $$(e)/*), $$(eval DIRS := $$(DIRS) $$(e))))
FILES := $$(filter-out $$(DIRS),$$(FILES))
ALLFILES := $$(ALLFILES) $$(FILES)
$$(foreach e,$$(DIRS),$$(eval $$(call EXPAND,$$(e)/)))
endef
$(eval $(call EXPAND))
############### Source of the xib and strings #################
XIBS = $(filter %.xib,$(ALLFILES))
STRS = $(filter %.strings,$(ALLFILES))
RTFS = $(filter %.rtf,$(ALLFILES))
### the compiled results of xib
NIBS = $(subst .xib,.nib,$(XIBS))
### There must be at least one strings file in the folder
### So it is safe to define the dir
LANG_DIRS = $(dir $(STRS))
############ the destination of every localization ############
DEST_DIRS = $(addprefix $(DESTROOT)/, $(LANG_DIRS))
TARGET_STRS = $(addprefix $(DESTROOT)/, $(STRS))
TARGET_NIBS = $(addprefix $(DESTROOT)/, $(NIBS))
TARGET_RTFS = $(addprefix $(DESTROOT)/, $(RTFS))
########################## Tragets #############################
all: $(TARGET_NIBS) $(TARGET_STRS) $(TARGET_RTFS)
.PHONY:clean
clean:
rm -Rf $(DESTROOT)
############################# rules ############################
$(DESTROOT)/%.nib: %.xib $(DESTROOT)
# cp "$<" "$@"
${IBTOOL} --compile "$@" "$<"
$(DESTROOT)/%.strings: %.strings $(DESTROOT)
cp "$<" "$@"
$(DESTROOT)/%.rtf: %.rtf $(DESTROOT)
cp "$<" "$@"
$(DESTROOT):
mkdir -p $(DEST_DIRS)