-
Notifications
You must be signed in to change notification settings - Fork 36
/
dev-makefile
129 lines (107 loc) · 3.59 KB
/
dev-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
127
128
129
FORCE:
TRIGGER_FILES = lib prog test dev-makefile
# Check package using make(1) and given compiler
check-make-comp:
-if find $(TRIGGER_FILES) Makefile -newer $(TARGET) | \
fgrep -v .git/ | egrep '.+' >/dev/null; then \
rm -f *.gz; \
$(MAKE) CC=$(CC) distcheck; \
fi
touch $(TARGET)
# Check package using make(1) and cc(1)
check-make-cc: FORCE
$(MAKE) -f dev-makefile CC=cc TARGET=$@ check-make-comp
# Check package using make(1) and clang(1)
check-make-clang: FORCE
$(MAKE) -f dev-makefile CC=clang TARGET=$@ check-make-comp
check-make: check-make-clang check-make-cc
touch $@
# Check package using cmake(1) and given compiler
check-cmake-comp:
-if find $(TRIGGER_FILES) CMakeLists.txt -newer $(TARGET) | \
fgrep -v .git/ | egrep '.+' >/dev/null; then \
rm *.rpm; \
rm -rf build; \
mkdir build; \
cd build; \
cmake .. -D CMAKE_C_COMPILER=cc; \
$(MAKE) all test install; \
cpack; \
mv *.rpm ..; \
fi
touch $(TARGET)
# Check package using cmake(1) and cc(1)
check-cmake-cc: FORCE
$(MAKE) -f dev-makefile CC=cc TARGET=$@ check-cmake-comp
# Check package using cmake(1) and clang(1)
check-cmake-clang: FORCE
$(MAKE) -f dev-makefile CC=clang TARGET=$@ check-cmake-comp
check-cmake: check-cmake-clang check-cmake-cc
touch $@
# Check package using cross product of build tools and compilers
check: check-make check-cmake
touch $@
# Scan code using clang(1)
clang-scan: check
scan-build --view $(MAKE)
COVERITY_SCAN_FILE = udunits2.tgz
# Create a submission file for Coverity Scan
$(COVERITY_SCAN_FILE): check
$(MAKE) clean
cov-build --dir cov-int $(MAKE)
tar czvf $(COVERITY_SCAN_FILE) cov-int
# Scan code using Coverity Scan
coverity-scan: $(COVERITY_SCAN_FILE)
curl --form token=82K450SW7qhKbtYSaXaSVA \
--form [email protected] \
--form file=@$(COVERITY_SCAN_FILE) \
--form version=`awk '{print $$1; exit}' CHANGE_LOG` \
--form description="make scan" \
https://scan.coverity.com/builds?project=Unidata%2FUDUNITS-2 \
> [email protected] # Redirection is necessary to avoid appearance of hanging
mv [email protected] $@
rm -rf cov-int
configure.ac: CHANGE_LOG
versionId=`awk '{print $$1;exit}' CHANGE_LOG`; \
if ! `echo "$$versionId" | egrep '^[0-9.]+$$' >/dev/null`; then \
echo "First word in file CHANGE_LOG isn't a version ID"; \
exit 1; \
fi; \
if test `sed -nr '/AC_INIT/{s/.*\[([0-9.]+)\].*/\1/p;q}' configure.ac` \!= \
$$versionId; then \
sed -r '/^AC_INIT\(/s/\[[0-9][0-9.]+\]/['$$versionId']/' configure.ac \
>configure.ac.tmp; \
mv configure.ac.tmp configure.ac; \
else \
touch $@; \
fi;
configure: configure.ac
autoreconf -fi
Makefile: configure
./configure --prefix=`cd .. && pwd`--enable-debug >&configure.log
CMakeLists.txt: CHANGE_LOG
versionId=`awk '{print $$1;exit}' CHANGE_LOG`; \
if ! `echo "$$versionId" | egrep '^[0-9.]+$$' >/dev/null`; then \
echo "First word in file CHANGE_LOG isn't a version ID"; \
exit 1; \
fi; \
if test `sed -nr '/^PROJECT/{s/.* ([0-9.]+).*$$/\1/p;q}' CMakeLists.txt` \!= \
$$versionId; then \
sed -r '/^PROJECT/s/ [0-9][0-9.]*/ '$$versionId'/' CMakeLists.txt \
>CMakeLists.txt.tmp; \
mv CMakeLists.txt.tmp CMakeLists.txt; \
else \
touch $@; \
fi;
version.texi: Makefile
$(MAKE) $@
consistent: configure CMakeLists.txt version.texi
touch $@
push: consistent check
./push
touch $@
release: push
@username=`awk '{print $$1; exit}' $$HOME/.ssh/nexus; \
password=`awk '{print $$2; exit}' $$HOME/.ssh/nexus; \
curl -v --user "$$username:$$password" --upload-file *.rpm \
http://localhost:8081/repository/yum-hosted/test.rpm