File: Makefile.in

package info (click to toggle)
fsvs 1.2.7-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 2,964 kB
  • ctags: 1,464
  • sloc: ansic: 16,650; sh: 5,885; perl: 783; makefile: 338; python: 90
file content (241 lines) | stat: -rw-r--r-- 8,222 bytes parent folder | download
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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
###########################################################################
 # Copyright (C) 2005-2009 Philipp Marek.                                #
 #                                                                       #
 # This program is free software;  you can redistribute it and/or modify #
 # it under the terms of the GNU General Public License version 2 as #
 # published by the Free Software Foundation.                            #
###########################################################################



################################ Definitions ################################
DIR	:= /usr/share/doc

HEADURL	:= "$URL: http://fsvs.tigris.org/svn/fsvs/tags/fsvs-1.2.7/fsvs/src/Makefile.in $"
HEADREV	:= "$Revision: 2478 $"
VERSION	= $(shell  perl -e '($$r) = (q( $(HEADREV) ) =~ m:(\d+):); $$t= q( $(HEADURL) ) =~ m:/tags/([^/]+): ? $$1 : "trunk"; print "$$t:$$r\n";' )

CFLAGS	:= @CFLAGS@
CFLAGS	+= -fgnu89-inline -Wall -funsigned-char -Os -DFSVS_VERSION='"$(VERSION)"'
LDFLAGS	:= @LDFLAGS@
FSVS_LDFLAGS = $(LDFLAGS)
FSVS_LIBS = -lsvn_subr-1 -lsvn_delta-1 -lsvn_ra-1 -lpcre -lgdbm -ldl
EXTRALIBS	:= @EXTRALIBS@
WAA_CHARS?= @WAA_WC_MD5_CHARS@

ifdef RPATH
LDFLAGS	+= -Wl,-rpath,$(RPATH)
endif

ifeq (@ENABLE_DEBUG@, 1)
	CFLAGS += -DDEBUG -g
	LDFLAGS += -g
ifeq (@ENABLE_GCOV@, 1)
	CFLAGS += -fprofile-arcs -ftest-coverage
	LDFLAGS += -fprofile-arcs
endif
endif

#	CFLAGS += -m64 -Wpadded
#	LDFLAGS += -m64



C_FILES	:= $(sort $(wildcard *.c))
H_FILES	:= $(wildcard *.h)
D_FILES := $(C_FILES:%.c=.%.d)
DEST	:= fsvs


################################ Targets ###################################
ifeq (@CHROOTER_JAIL@, )
all:	deps tags check-version check-dox $(DEST) lsDEST
else
all:	tools/fsvs-chrooter
endif


check-version: config.h fsvs.c
	@dev/check-version-output.pl $^

check-dox: options.c dox/options.dox
	@dev/check-option-docs.pl $^

tags:	$(C_FILES) $(wildcard *.h)
	@echo "     $@"
	@-ctags $^
	@echo ":au BufNewFile,BufRead *.c syntax keyword Constant" $(shell grep -v "^!" < $@ | cut -f1 | grep _) > .vimrc
.IGNORE: tags
clean:
	rm -f *.o *.s $(D_FILES) $(DEST) 2> /dev/null || true

lsDEST: $(DEST)
	@ls -la $<

version:
	@echo $(VERSION)

version-nnl:
	@perl -e '$$_=shift; s/\s+$$//; print;' $(VERSION)

.SILENT: version.nnl version
.PHONY: version-nnl version 


################################ Distribution ###############################

bindir	= @bindir@
exec_prefix= @exec_prefix@
prefix	= @prefix@
mandir	= @mandir@
install:
	mkdir -p $(DESTDIR)/etc/fsvs $(DESTDIR)/var/spool/fsvs $(DESTDIR)$(bindir) $(DESTDIR)/etc/fsvs/svn/auth/svn.simple $(DESTDIR)/etc/fsvs/svn/auth/svn.ssl.server $(DESTDIR)/etc/fsvs/svn/auth/svn.ssl.client-passphrase
	install -m 0755 $(DEST) $(DESTDIR)/$(bindir)
#	install -m 0644 ../doc/fsvs.1 $(DESTDIR)/(mandir)

# No automatic rebuild (?)
#../doc/USAGE: $(C_FILES) $(H_FILES)
#.PHONY: ../doc/USAGE
DOXDIR=../../doxygen/html/
MANDIR=../../doxygen/man/man1/
MANDEST=../doc/
DOXFLAG=../../doxygen/html/index.html
$(DOXFLAG):
	( cat doxygen-data/Doxyfile-man ; echo PROJECT_NUMBER=$(VERSION)) | doxygen -
	( cat doxygen-data/Doxyfile ; echo PROJECT_NUMBER=$(VERSION)) | doxygen -
	# Change the /ยง* to the correct /*
	cd $(DOXDIR) && perl -i.bak -pe '1 while s#([/*])\xc2?\xa7([/*])#\1\2#;' *.html
	cd $(MANDIR) && perl -i.bak -pe '1 while s#([/*])\xc2?\xa7([/*])#\1\2#;' *.?
	rm $(DOXDIR)/*.bak $(DOXDIR)/html-doc.zip || true
	cd $(DOXDIR)/.. && zip -rq9 html-doc.zip html -x 'html/.svn/*' && tar -cf html-doc.tar --exclude .svn html && bzip2 -vkf9 html-doc.tar && gzip -vf9 html-doc.tar
$(DOXDIR)/group__cmds.html: $(DOXFLAG)
	touch $@
$(DOXDIR)/group__ignpat.html: $(DOXFLAG)
	touch $@

# Fix for badly generated man page (Doxygen)
# Some other idea? Is there some other workaround?
$(MANDEST)/fsvs.1: $(MANDIR)/cmds.1
	tools/man-repair.pl $@ "FSVS - fast versioning tool" < $<
$(MANDEST)/fsvs-howto-backup.5: $(MANDIR)/howto_backup.1
	tools/man-repair.pl $@ "FSVS - Backup HOWTO" < $<
$(MANDEST)/fsvs-howto-master_local.5: $(MANDIR)/howto_master_local.1
	tools/man-repair.pl $@ "FSVS - Master/Local HOWTO" < $<
$(MANDEST)/fsvs-options.5: $(MANDIR)/options.1
	tools/man-repair.pl $@ "FSVS - Options and configfile" < $<
$(MANDEST)/fsvs-url-format.5: $(MANDIR)/url_format.1
	tools/man-repair.pl $@ "FSVS - URL format" < $<
$(MANDEST)/fsvs-groups.5: $(MANDIR)/groups_spec.1
	tools/man-repair.pl $@ "FSVS - Group definitions" < $<
$(MANDEST)/fsvs-ignore-patterns.5: $(MANDIR)/ignpat.1
	tools/man-repair.pl $@ "FSVS - Ignore definitions" < $<

../doc/USAGE: $(DOXDIR)/group__cmds.html
	dev/dox2txt.pl $< > $@
../doc/IGNORING: $(DOXDIR)/group__ignpat.html
	dev/dox2txt.pl $< > $@
doc.g-c: ../doc/USAGE
	# Generate static text strings
	( cat $< ; echo "end" ) | dev/make_doc.pl > $@
docs: $(DOXFLAG) ../doc/USAGE ../doc/IGNORING doc.g-c 
docs: $(MANDEST)/fsvs.1 $(MANDEST)/fsvs-options.5 
docs: $(MANDEST)/fsvs-url-format.5 $(MANDEST)/fsvs-groups.5
docs: $(MANDEST)/fsvs-howto-backup.5 $(MANDEST)/fsvs-howto-master_local.5
.PHONY: docs $(DOXFLAG)


################################ Rules ######################################
%.o:	%.c
#	@echo "     CC $<"
	$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<

# if the Makefile has changed, the output will (at least sometimes)
# change, too.
$(DEST): $(C_FILES:%.c=%.o)
#	@echo "     Link $@"
	$(CC) $(FSVS_LDFLAGS) -o $@ $^ $(FSVS_LIBS) $(LDLIBS) $(LIBS) $(EXTRALIBS)
ifeq (@ENABLE_RELEASE@, 1)
	-strip $@
endif


# For debugging: generate preprocessed, generate assembler
%.s:	%.c
	$(CC) $(CFLAGS) -S -fverbose-asm -o $@ $< || true
%.P	: %.c
	$(CC) $(CFLAGS) -E -o $@ $<


############################### Dependencies ################################
deps:	$(D_FILES)
.%.d:	%.c
#	@echo "     deps for $<"
	$(CC) $(CPPFLAGS) $(CFLAGS) -MM $< | perl -pe 's#\bdoc.g-c\b##' > $@
include $(D_FILES)

tools/fsvs-chrooter: tools/fsvs-chrooter.c
tools/fsvs-chrooter: interface.h config.h

############################### GCov Usage ################################
ifeq (@ENABLE_GCOV@, 1)
GCOV_FILES := $(C_FILES:%.c=%.c.gcov)
GCOV_SMRY_FILES := $(GCOV_FILES:%.gcov=%.gcov.smry)
GCOV_DATA := $(C_FILES:%.c=%.gcda) $(C_FILES:%.c=%.gcno)

gcov:  $(GCOV_FILES)
	@dev/gcov-summary.pl $(GCOV_SMRY_FILES)

%.c.gcov:	%.c
	@gcov -f $< > $<.gcov.smry
# -b -c

gcov-clean:
	rm -f *.gcov *.gcov.smry *.gcda 2> /dev/null || true

gcov-unused-funcs:
	grep -B1 ":0.00%" *.gcov.smry

.PHONY: gcov gcov-clean
endif


################################ Statistics #################################
diffstat:
	svk diff | diffstat

count:
	@echo "sum of lines:                        "`cat $(C_FILES) $(H_FILES) | wc -l -`
	@echo "sum w/o comments, {, }, empty lines: "`perl -e 'undef $$/; while (<>) { 1 while s#//.*##; 1 while s#/\\*[\\x00-\\xff]*?\\*/##; 1 while s#\s*[{}]\s*##; $$c++ while s#[\r\n]+# #; }; sub END { print $$c,"\n" } ' $(C_FILES) $(H_FILES)` 

revcount: count
	@last_rev=$(shell svk info | grep Revision | cut -d" " -f2) ; echo "number of edits up to revision $$last_rev:" ; for r in `seq 2 $$last_rev` ; do svk diff -r`expr $$r - 1`:$$r /svn2/trunk ; done | perl -pe 's#\ssrc/# #g;' | diffstat

structs: $(DEST)
	@for a in `perl -ne 'print $$1,"\n" if m#^\s*struct\s+(\w+)\s+{\s*$$#' $(C_FILES) $(H_FILES)` ; do printf "%-30s " "struct $$a" ; gdb --batch -ex "printf \"\t%6d\", sizeof(struct $$a)" $(DEST) | cut -f2 -d= ; done 2>&1 | sort -k3 -n

.PHONY:	revcount count diffstat


################################ Testing ####################################
run-tests: $(DEST)
	WAA_CHARS=$(WAA_CHARS) $(MAKE) -C ../tests BINARY=$(shell pwd)/$(DEST) $(TESTS)
ifeq (@ENABLE_GCOV@, 1)
# I don't know why, but gcov wants to open the .gcda and .gcno
# files Read-Write. I filed a bug report for this.
# If the tests are run as root (which is currently necessary because
# of the devices and device-tests), the normal user who compiled
# the sources will not be allowed to open this files ...
#
# Not all files have code .. and so not all files (of the generated list) 
# will exist; therefore "true".
	-@chmod 777 $(GCOV_DATA) > /dev/null 2>&1
endif

ext-tests: $(DEST)
	dev/permutate-all-tests

.PHONY:	run-tests ext-tests


################################ -- THE END -- ##############################
## vi: ts=8 sw=8