-
-
Notifications
You must be signed in to change notification settings - Fork 91
/
dist.mak
156 lines (138 loc) · 5.11 KB
/
dist.mak
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# -*- makefile -*-
include config.inc
SUDO = sudo
GREG = bin/greg${EXE}
ifeq (${PREFIX},)
$(error need to make config first)
endif
ifeq (${DLL},)
$(error need to make config first)
endif
VERSION = $(shell ./tools/config.sh "${CC}" version)
PLATFORM = $(shell ./tools/config.sh "${CC}" target)
RELEASE ?= ${VERSION}.${REVISION}
PKG = potion-${RELEASE}
PKGBIN = ${PKG}-${PLATFORM}
PKG_DESC = "potion language"
ifeq (${WIN32},1)
BINDIST = pkg/${PKGBIN}.zip
else
BINDIST = pkg/${PKGBIN}.tar.gz pkg/${PKGBIN}-devel.tar.gz
endif
dist: bin-dist src-dist
release: dist
# sudo gem install fpm
# pkgin is for BSD, with pkg_create
# TODO: need a simple one-line windows cmd-line installer from the zip
define EXPAND_DEPLOY
ifneq ($$(WIN32),1)
deploy: release
rm -rf dist
mkdir dist
tar xfz pkg/${PKGBIN}.tar.gz -C dist/
tar xfz pkg/${PKGBIN}-devel.tar.gz -C dist/
ifeq ($$(DLL),.so)
fpm -s dir -t deb -C dist -p pkg --name potion --version $(VERSION) --description $(PKG_DESC)
fpm -s dir -t rpm -C dist -p pkg --name potion --version $(VERSION) --description $(PKG_DESC)
-fpm -s dir -t pkgin -C dist -p pkg --name potion --version $(VERSION) --description $(PKG_DESC)
endif
ifeq ($$(DLL),.dylib)
fpm -s dir -t osxpkg -C dist -p pkg --name potion --version $(VERSION) --description $(PKG_DESC)
endif
rm -rf dist
endif
endef
$(eval $(call EXPAND_DEPLOY))
install: bin-dist
${SUDO} tar xfz pkg/${PKGBIN}.tar.gz -C $(PREFIX)/
bin-dist: ${BINDIST}
pkg/${PKGBIN}.tar.gz: core/config.h core/version.h bin/potion${EXE} \
lib/libpotion${DLL} lib/potion/readline${LOADEXT}
rm -rf dist
mkdir -p dist dist/bin dist/include/potion dist/lib/potion \
dist/share/potion/doc dist/share/potion/example
cp bin/potion${EXE} dist/bin/
cp lib/libpotion${DLL} dist/lib/
cp -r lib/potion dist/lib/
if [ ${WIN32} = 1 ]; then mv dist/lib/*.dll dist/bin/; fi
-if [ $(APPLE) = 1 ]; then rsync -a lib/libuv*.dylib dist/lib/; fi
cp core/potion.h dist/include/potion/
cp core/config.h dist/include/potion/
-cp doc/*.html doc/*.png dist/share/potion/doc/
-cp doc/core-files.txt dist/share/potion/doc/
-cp README.md COPYING LICENSE ChangeLog dist/share/potion/doc/
cp example/* dist/share/potion/example/
-mkdir -p pkg
(cd dist && tar czf ../pkg/${PKGBIN}.tar.gz * && cd ..)
rm -rf dist
pkg/${PKGBIN}.zip: core/config.h core/version.h core/syntax.c bin/potion${EXE} \
lib/libpotion${DLL} lib/libuv.dll.a lib/potion/readline${LOADEXT}
rm -rf dist
mkdir -p dist dist/lib dist/include/potion dist/lib/potion dist/doc dist/example dist/test/
cp bin/potion${EXE} dist/
cp ${GREG} dist/
cp lib/libpotion${DLL} dist/
cp lib/libuv-*.dll dist/
cp lib/libuv.dll.a dist/lib
cp -r lib/potion/* dist/lib/potion/
cp core/potion.h dist/include/potion/
cp core/config.h dist/include/potion/
-cp doc/*.html doc/*.png dist/doc/
if [ -f doc/html/potion.chm ]; then \
cp doc/html/potion.chm dist/doc/potion.chm; \
else cp -r doc/html dist/doc/; \
fi
-cp -r doc/ref dist/doc/
-cp doc/core-files.txt dist/doc/
-cp README.md COPYING LICENSE ChangeLog dist/doc/
cp example/* dist/example/
cp -r test/* dist/test/
-mkdir -p pkg
(cd dist && zip -q ../pkg/${PKGBIN}.zip -rm * && cd ..)
rm -rf dist
pkg/${PKGBIN}-devel.tar.gz: ${GREG} bin/potion-s${EXE} lib/libpotion.a
${MAKE} doxygen GTAGS
rm -rf dist
mkdir -p dist dist/bin dist/include/potion dist/lib/potion \
dist/share/potion/doc/ref dist/share/potion/test
cp ${GREG} dist/bin/
cp bin/potion-s${EXE} dist/bin/
cp lib/libpotion.a dist/lib/
cp core/*.h dist/include/potion/
rm dist/include/potion/potion.h dist/include/potion/config.h
-cp -r doc/*.textile doc/html dist/share/potion/doc/
-cp -r doc/latex I*.md doc/I*.md dist/share/potion/doc/
-cp -r doc/ref/* dist/share/potion/doc/ref/
cp -r test/* dist/share/potion/test/
-mkdir -p pkg
(cd dist && tar czf ../pkg/${PKGBIN}-devel.tar.gz * && cd ..)
rm -rf dist
src-dist: pkg/${PKG}-src.tar.gz
pkg/${PKG}-src.tar.gz: tarball
#TODO: you should be able to build without git
tarball: core/version.h core/syntax.c
-mkdir -p pkg
rm -rf ${PKG}
git checkout-index --prefix=${PKG}/ -a
rm -f ${PKG}/.gitignore
+${MAKE} MANIFEST
cp MANIFEST ${PKG}/
cp core/version.h ${PKG}/core/
cp core/syntax.c ${PKG}/core/
tar czf pkg/${PKG}-src.tar.gz ${PKG}
rm -rf ${PKG}
GTAGS: ${SRC} core/*.h
rm -rf ${PKG} doc/ref
git checkout-index --prefix=${PKG}/ -a
-cp core/version.h ${PKG}/core/
cd ${PKG} && \
mv tools/greg.c tools/greg-c.tmp && \
gtags && htags && \
sed -e's,background-color: #f5f5dc,background-color: #ffffff,' < HTML/style.css > HTML/style.new && \
mv HTML/style.new HTML/style.css && \
mv tools/greg-c.tmp tools/greg.c && \
cd .. && \
mv ${PKG}/HTML ${PKG}/ref && \
mv ${PKG}/ref doc/
rm -rf ${PKG}
.PHONY: dist release deploy install tarball src-dist bin-dist