forked from frePPLe/frepple
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.dist
162 lines (142 loc) · 6.36 KB
/
Makefile.dist
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
157
158
159
160
161
162
#
# Copyright (C) 2007-2013 by Johan De Taeye, frePPLe bvba
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#
# This makefile is built as a convenience for developers.
# It provides easy to use wrappers around common administration, configuration, build
# and maintenance tasks:
# CONFIGURING
# - prep: Initializes the AutoMake tools.
# BUILDING AND COMPILING
# - default: Configures and recreates an optimized build from scratch.
# - debug: Configures and recreates a debug build from scratch.
# - coverage: Configures and recompiles the code for coverage testing.
# - profile: Configures and recompiles the code suitable for profiling.
# - build: Compiles a configured project.
# - clean: Cleans up all intermediate files.
# - check: Runs the test suite.
# - gdb: Run the gdb debugger
# DISTRIBUTION TASKS
# - dist: Creates a source code tarball.
# CODE ANALYSIS
# - stats: Runs a simple lines-of-code metric on the source code.
# - todo: Greps for todo items in the source code.
# - astyle: Runs the astyle code beautifier.
# CODE MAINTENANCE
# - set_release: Updates all references to the release number from an old to a new number.
#
default: prep config clean build dist check
debug: prep configdebug clean build check
coverage: prep configcoverage clean build check
profile: prep configprofile clean build
prep:
@echo
@echo "PHASE: Configuring GNU build tools..."
aclocal
autoheader
libtoolize --copy --force --automake
automake --add-missing --force-missing --copy
autoconf
config:
@echo
@echo "PHASE: Running configure for optimized build..."
./configure --enable-doc
#--prefix=`pwd`/install-test --sysconfdir=`pwd`/install-test/etc
configdebug:
@echo
@echo "PHASE: Running configure for debug build..."
./configure --disable-doc --enable-debug
configcoverage:
@echo
@echo "PHASE: Running configure for test coverage build..."
./configure --disable-doc --enable-coverage
configprofile:
@echo
@echo "PHASE: Running configure for profiling build..."
./configure --disable-doc --enable-profile
clean:
@echo
@echo "PHASE: Cleaning..."
make clean
build:
@echo
@echo "PHASE: Building..."
make all
check:
@echo
@echo "PHASE: Testing..."
make check
dist:
@echo
@echo "PHASE: Making a distribution..."
make dist
gdb:
export FREPPLE_HOME=$(CURDIR)/bin; \
export PYTHONPATH=$(CURDIR)/contrib/django/; \
export DJANGO_SETTINGS_MODULE=freppledb.settings; \
export LD_LIBRARY_PATH=$ROOT/src/.libs; \
export webservice=1; \
libtool --mode=execute gdb --args $(CURDIR)/src/frepple $(CURDIR)/contrib/django/freppledb/execute/commands.py
# valgrind --leak-check=yes $ROOT/src/.libs/frepple $ROOT/contrib/django/freppledb/execute/commands.py
# valgrind --tool=callgrind --dsymutil=yes $ROOT/src/.libs/frepple $ROOT/contrib/django/freppledb/execute/commands.py
# A simple way to get some code metrics
stats:
wc -l `find src -name '*.cpp'` \
`find modules -name '*.cpp'` \
`find contrib -name '*.cpp'` \
`find src -name '*.h'` \
`find include -name '*.h'` \
`find . -name '*.xsd'` \
`find . -name '*.nsi'` \
`find . -name '*.am'` \
`find . -name '*.ac'` \
`find modules -name '*.h'` | grep -v config.h | sort -n
wc -l `find . -name '*.py'` | sort -n
wc -l `find contrib -name '*.html'` \
contrib/django/freppledb/common/static/js/frepple.js \
contrib/django/freppledb/common/static/css/frepple.css | sort -n
# A simple way to list the todo items
todo:
grep -i todo `find . -name '*.cpp'` `find . -name '*.h'` `find . -name '*.xml'` `find . -name '*.py'` | sort
grep -i todo `find . -name '*.cpp'` `find . -name '*.h'` `find . -name '*.xml'` `find . -name '*.py'` | wc
# Reformats the code to comply to some common standard
# Our formatting is closely aligned with the CoreLinux standards
astyleoptions = --style=ansi --indent=spaces=2 --indent-classes --indent-switches --min-conditional-indent=2 --keep-one-line-statements --keep-one-line-blocks --max-instatement-indent=2 --convert-tabs
astyle:
astyle --mode=c $(astyleoptions) `find . -name '*.cpp'`
astyle --mode=c $(astyleoptions) `find . -name '*.h'`
# The release number is (unfortunately) stored in a number of independent places:
# This make target is used to consistently update all those places.
# * The first 2 arguments need to be integers.
# * The third argument can be empty. Or it can be a string starting with a '.'/dot.
old1 = 2
old2 = 1
old3 =
new1 = 2
new2 = 2
new3 = .beta
set_release:
for i in "configure.ac" "include/frepple/utils.h" "contrib/rpm/frepple.spec" "contrib/django/freppledb/__init__.py" "contrib/django/freppledb/locale/nl/LC_MESSAGES/django.po" "contrib/django/freppledb/locale/nl/LC_MESSAGES/djangojs.po" "contrib/django/freppledb/locale/zh_TW/LC_MESSAGES/django.po" "contrib/django/freppledb/locale/zh_TW/LC_MESSAGES/djangojs.po" "contrib/django/freppledb/locale/it/LC_MESSAGES/django.po" "contrib/django/freppledb/locale/it/LC_MESSAGES/djangojs.po" "contrib/django/freppledb/locale/fr/LC_MESSAGES/django.po" "contrib/django/freppledb/locale/fr/LC_MESSAGES/djangojs.po" "contrib/django/freppledb/locale/ja/LC_MESSAGES/django.po" "contrib/django/freppledb/locale/zh_CN/LC_MESSAGES/djangojs.po" "bin/frepple.xsd" "bin/frepple_core.xsd" "contrib/debian/changelog"; do \
sed 's/$(old1)\.$(old2)$(old3)/$(new1).$(new2)$(new3)/g' $$i >out.tmp; \
mv out.tmp $$i; \
done
sed 's/Version "$(old1)\.$(old2)\./Version "$(new1).$(new2)./g' "contrib/installer/frepple.nsi" >out.tmp
sed 's/PRODUCT_VERSION "$(old1)\.$(old2)$(old3)"/PRODUCT_VERSION "$(new1).$(new2)$(new3)"/' out.tmp >"contrib/installer/frepple.nsi"
for i in "src/dll.rc" "src/exe.rc"; do \
sed 's/$(old1),$(old2),/$(new1),$(new2),/g' $$i >out.tmp; \
sed 's/$(old1), $(old2),/$(new1), $(new2),/g' out.tmp >$$i; \
rm out.tmp; \
done