-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
126 lines (104 loc) · 3.79 KB
/
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
VER=$(shell awk -F\" '/version/ {print $$2}' wipha/configs/wipha.conf)
DMG=WiPhA_v$(VER).dmg
DMG_ROOT=/tmp/wiphaDmgRoot
DMG_IMG_DIR=$(DMG_ROOT)/doc/img
DMG_SRC_DIR=$(DMG_ROOT)/src
DMG_LICENSE=$(DMG_ROOT)/LICENSE.txt
DMG_README=$(DMG_ROOT)/README.html
INSTALLER=$(DMG_ROOT)/WiPhA\ Installer.app
TBZ=wipha.tbz
INSTALL_SCRIPT=install_script
CHANGEPERM=wipha/changeperm
APACHE_RESTART=apacheRestart
GET_TRUE_NAME=wipha/getTrueName
.PHONY: default dmgBaseContent help src clean
default: $(DMG)
$(DMG): dmgBaseContent $(INSTALLER) help src
hdiutil create -ov -fs HFS+ -scrub -srcfolder $(DMG_ROOT) -volname "WiPhA $(VER)" "$@"
dmgBaseContent: $(DMG_IMG_DIR) $(DMG_SRC_DIR) $(DMG_LICENSE) $(DMG_README)
$(DMG_IMG_DIR):
@ mkdir -p $(DMG_ROOT)/doc/img
$(DMG_SRC_DIR):
@ mkdir -p $(DMG_ROOT)/src
$(DMG_LICENSE): build_resources/LICENSE.txt
@ cp "$<" "$@"
$(DMG_README):
@ [ -h "$@" ] || ln -s doc/index.html "$@"
$(INSTALLER): $(INSTALL_SCRIPT) build_installer $(TBZ) $(APACHE_RESTART)
./build_installer $(INSTALL_SCRIPT) "$@" $(TBZ) $(APACHE_RESTART) "$(VER)"
$(TBZ): $(CHANGEPERM) $(GET_TRUE_NAME) FORCE
@ cp build_resources/LICENSE.txt wipha/
tar jcf "$@" \
--exclude ".svn" \
--exclude "wipha/test.*" \
--exclude "wipha/data/*.ser" \
--exclude "wipha/data/*.dat" \
--exclude "wipha/data/cache/*.*" \
--exclude "wipha/3rdParty/phpZipLight" \
wipha
$(VER): wipha/configs/wipha.conf
@ awk -F\" '/version/ {print $$2}' "$<" > "$@"
# Carbon framework only required for getTrueName
wipha/% : %.c
@ echo "Build $@" ; \
gcc -Wall -arch i386 -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.6 -o "$@" "$<" -framework Carbon ; chmod 4755 "$@"
% : %.c
@ echo "Build $@" ; \
gcc -Wall -arch i386 -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.6 -o "$@" "$<"
HELP_FILES=install.html \
admin.html \
intro.html \
index.html \
usage.html \
history.html
TRGD=$(DMG_ROOT)/doc
SRCD=$(DMG_ROOT)/src
TPLD=wipha/templates
RSCD=build_resources/doc
IDX=TPLD/help_index.tpl
DMG_HELP=$(HELP_FILES:%=$(DMG_ROOT)/doc/%)
GUPPY_SRC=$(filter-out install.html,$(HELP_FILES))
GUPPY_HELP=$(GUPPY_SRC:%=guppydoc/%)
help: $(DMG_HELP) $(GUPPY_HELP) FORCE
@ cp $(RSCD)/*.jpg $(TRGD)/img
@ cp $(RSCD)/wiphadoc.css $(TRGD)/img
@ cp wipha/img/* $(TRGD)/img
@ cp wipha/skin/orig/wiphacommon.css $(TRGD)/img
@ cd guppydoc; if [ $$(cat intro.html|wc -l) == "1" ]; then \
cat intro.html >> index.html; mv index.html intro.html; \
fi
src: apacheRestart.c changeperm.c getTrueName.c
@ cp $? $(SRCD)/
# DMG doc from wipha templates
$(TRGD)/%.html: $(TPLD)/help_%.tpl $(RSCD)/header.html $(RSCD)/menu.html $(RSCD)/footer.html
@ echo "Build $@" ; \
echo "" > "$@"; \
cat $(RSCD)/header.html >> "$@"; \
cat "$<" >> "$@"; \
if [ "$<" == "$(TPLD)/help_index.tpl" ]; then \
cat $(RSCD)/menu.html >> "$@"; \
fi; \
cat $(RSCD)/footer.html >> "$@"
# DMG additional doc (install, history)
$(TRGD)/%.html: $(RSCD)/%.html $(RSCD)/header.html $(RSCD)/footer.html
@ echo "Build $@" ; \
echo "" > "$@"; \
cat $(RSCD)/header.html >> "$@"; \
cat "$<" >> "$@"; \
cat $(RSCD)/footer.html >> "$@"
# GuppY doc from wipha templates
guppydoc/%.html: $(TPLD)/help_%.tpl
@ echo "Build $@" ; \
tr -s "\n\t" " " < "$<" | sed -e "s/img\//img\/wipha\//g" > "$@"
# GuppY additional doc
guppydoc/%.html: $(RSCD)/%.html
@ echo "Build $@" ; \
tr -s "\n\t" " " < "$<" | sed -e "s/img\//img\/wipha\//g" > "$@"
FORCE:
clean:
@ rm -rf $(TBZ) $(DMG) $(DMG_ROOT) $(GUPPY_HELP) $(APACHE_RESTART) $(CHANGEPERM) $(GET_TRUE_NAME)
essai.app:
./build_installer essai_script "$@" pipo "$(VER)"
@ cp wipha.pax essai.app/Contents/Resources
test:
@echo $(GUPPY_HELP)