-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure
82 lines (65 loc) · 2.22 KB
/
configure
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
#!/bin/bash
CMAKE_W_ROOT=/tmp/cmake_w
RELEASE_DIR=Release
DEBUG_DIR=Debug
# ----------------------------------------------------------------------- #
# #
# ----------------------------------------------------------------------- #
f_date()
{
date '+%y%m%d_%H%M'
}
# ----------------------------------------------------------------------- #
# #
# ----------------------------------------------------------------------- #
f_cmake_arbo()
{
if [ -d ${CMAKE_W_ROOT} ];
then
rm -rf ${CMAKE_W_ROOT}
fi
mkdir -p ${CMAKE_W_ROOT}/${RELEASE_DIR} ${CMAKE_W_ROOT}/${DEBUG_DIR}
}
# ----------------------------------------------------------------------- #
# #
# ----------------------------------------------------------------------- #
f_cmake_configure()
{
cd ${CMAKE_W_ROOT}/${RELEASE_DIR}
cmake -G "MSYS Makefiles" -DCMAKE_BUILD_TYPE=Release ${PROJECT_DIR}
cd ${CMAKE_W_ROOT}/${DEBUG_DIR}
cmake -G "MSYS Makefiles" -DCMAKE_BUILD_TYPE=Debug ${PROJECT_DIR}
}
# ----------------------------------------------------------------------- #
# #
# ----------------------------------------------------------------------- #
f_top_makefile()
{
GMAKEFILE=${PROJECT_DIR}/Makefile
echo "GENDATE=$(f_date)" > ${GMAKEFILE}
echo "PROJECT_NAME=mmwincompat" >> ${GMAKEFILE}
echo "DEBUG_DIR=${CMAKE_W_ROOT}/${DEBUG_DIR}" >> ${GMAKEFILE}
echo "RELEASE_DIR=${CMAKE_W_ROOT}/${RELEASE_DIR}" >> ${GMAKEFILE}
cat >> ${GMAKEFILE} << "EOF"
main: release debug
release: check
@ cd $(RELEASE_DIR); make -s
verbose_release: check
@ cd $(RELEASE_DIR); make VERBOSE=1
debug: check
@ cd $(DEBUG_DIR); make -s
.PHONY: clean
clean:
@ cd $(RELEASE_DIR); make -s clean
@ cd $(DEBUG_DIR); make -s clean
check:
@ [ -d $(RELEASE_DIR) ] || ./configure
.PHONY: archive
archive:
git archive HEAD --prefix=$(PROJECT_NAME)_$(GENDATE)/ --format=tar.gz -o /tmp/$(PROJECT_NAME)_$(GENDATE).tar.gz
EOF
}
PROJECT_DIR=$(pwd)
f_cmake_arbo
f_cmake_configure
f_top_makefile