File: Makefile.maint

package info (click to toggle)
exuberant-ctags 1%3A2.3.2-1
  • links: PTS
  • area: main
  • in suites: slink
  • size: 452 kB
  • ctags: 645
  • sloc: ansic: 4,625; makefile: 130; sh: 33
file content (281 lines) | stat: -rw-r--r-- 7,571 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
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
#*****************************************************************************
#	$Id: Makefile.maint,v 6.12 1998/08/29 04:55:17 darren Exp $
#
#   Development makefile for Exuberant Ctags, used to build releases.
#
#	Copyright (c) 1996-1998, Darren Hiebert
#*****************************************************************************

SOURCES		=	entry.c get.c main.c options.c parse.c read.c sort.c
DSOURCES	=	$(SOURCES) debug.c 
HEADERS		=	ctags.h

VERSION_FILES=	ctags.h ctags.1 ctags.lsm NEWS

DIST_FILES	=	COPYING FAQ INSTALL INSTALL.DOS QUOTES README \
				Makefile.in configure.in acconfig.h mkinstalldirs \
				Makefile.amiga Makefile.bcc Makefile.djg Makefile.maint \
				Makefile.os2 Makefile.w32 os_vms.mms \
				$(DSOURCES) strstr.c 

DOS_FILES	=	COPYING FAQ INSTALL.DOS QUOTES README \
				Makefile.amiga Makefile.bcc Makefile.djg \
				Makefile.os2 Makefile.w32 \
				$(DSOURCES)

RCS_FILES	=	$(DIST_FILES) $(VERSION_FILES) Makefile.maint \
				ctags.spec COPYING.short

WARNINGS	=	-Wall -W -Wtraditional -Wpointer-arith -Wcast-align \
				-Wwrite-strings -Wmissing-prototypes -Wmissing-declarations \
				-Wnested-externs -Wcast-qual -Wshadow \
				-pedantic -Wstrict-prototypes # -Wconversion -Werror 

ERRFILE	= errors
REDIR 	= 2>&1 | tee $(ERRFILE)

RPM_ROOT= $(HOME)/Develop
CTAGS_DOSDIR = /mnt/dos/ctags
WEB_ARCHIVE_DIR = $(HOME)/public_html/archives
DEP_DIR	= .deps

CC		= egcs
DEFS	= -I. -DHAVE_CONFIG_H
CFLAGS	= $(DEFS) $(WARNINGS)
OPT		= -O3
DCFLAGS	= $(CFLAGS) -DDEBUG -DINTERNAL_SORT
DLFLAGS	= -lefence
LD		= gcc

AUTO_GEN	= configure config.h.in
CONFIG_GEN	= config.cache config.log config.status config.run config.h Makefile
PROF_GEN	= gmon.out *.da *.bb *.bbg *.gcov

#
# Targets
#
ifeq ($(findstring clean,$(MAKECMDGOALS)),)
ifneq ($(MAKECMDGOALS),setup)
ifeq ($(wildcard config.h),)
ctags dctags ctags.prof ctags.gcov:
	$(MAKE) config.h
	$(MAKE) $(MAKECMDGOALS)
else
all: ctags dctags tags syntax.vim

include $(DSOURCES:%.c=$(DEP_DIR)/%.d)

#
# Executable targets
#
ctags: $(SOURCES:.c=.o)
	@ echo "-- Linking $@"
	@ $(LD) $(LFLAGS) $^ -o $@

dctags: $(DSOURCES) $(HEADERS) Makefile
	@ echo "-- Building $@"
	@ $(CC) -g $(DCFLAGS) $(DSOURCES) $(DLFLAGS) -o $@ $(REDIR)

ctags.prof: $(SOURCES) $(HEADERS) Makefile
	$(CC) -O3 -pg $(CFLAGS) $(SOURCES) -o $@

ctags.cov: $(SOURCES) $(HEADERS) Makefile
	$(CC) -fprofile-arcs -ftest-coverage $(CFLAGS) $(SOURCES) -o $@

gcov: $(SOURCES:.c=.gcov)

endif
endif
endif

ctags32.exe: $(SOURCES) $(HEADERS)
	gcc-dos -DMSDOS -O4 -Wall -s -o $@ $(SOURCES)

#
# Support targets
#
FORCE:

config.h.in: acconfig.h configure.in
	autoheader
	@ touch $@

configure: configure.in
	autoconf

config.h: config.h.in configure
	./configure --enable-maintainer-mode
	@ touch $@

profclean:
	rm -f $(PROF_GEN)

clean: profclean
	rm -f *.[oi] $(DEP_DIR)/*.d ctags dctags ctags*.exe ctags.man \
	      ctags.prof ctags.cov tags TAGS syntax.vim $(ERRFILE)

distclean: clean
	rm -f $(CONFIG_GEN)

maintainer-clean maintclean: distclean
	rm -f $(AUTO_GEN)

ctags.man: ctags.1
	@ groff -Tascii -mandoc $< | sed 's/.//g' > $@

tags: $(DSOURCES) $(HEADERS)
	@ ctags $^

#
# Create a Vim syntax file for all typedefs
#
syntax: syntax.vim
syntax.vim: $(DSOURCES) $(HEADERS)
	@ ctags -i=ctS -o- $^ |\
		awk 'BEGIN{printf("syntax keyword Typedef\t")}\
				{printf("%s ", $$1)}END{print ""}' > $@

#
# RCS management
#
co:
	-@ (cd RCS; rlog -L -R * | sed -e 's/,v$$//')

checkin:
	@ ci -u `rlog -L -R RCS/* | sed -e 's:RCS/::' -e 's/,v$$//'`

rcs-release:
	-co -l $(RCS_FILES)
	ci -u -f6.1 -n"V2_1" -m"Formal release of 2.1" $(RCS_FILES)

rcs-files:
	@ls -1 $(RCS_FILES)

#
# Release management
#
ctags-%.tar.gz: $(DIST_FILES) $(VERSION_FILES)
	@ echo "---------- Building tar ball"
	if [ -d ctags-$* ] ;then rm -fr ctags-$** ;fi
	mkdir ctags-$*
	cp -p $(DIST_FILES) ctags-$*/
	for file in $(VERSION_FILES) ;do \
		sed -e "s/@@VERSION@@/$*/" \
		    -e "s/@@LSMDATE@@/`date +'%d%b%y' | tr 'a-z' 'A-Z'`/" \
			$${file} > ctags-$*/$${file} ;\
	done
	chmod 644 ctags-$*/*
	chmod 755 ctags-$*/mkinstalldirs
	(cd ctags-$*; autoheader; chmod 644 config.h.in)
	(cd ctags-$*; autoconf; chmod 755 configure)
	tar -zcf $@ ctags-$*

ctags-%.tar.Z: ctags-%.tar.gz
	tar -Zcf $@ ctags-$*

vim-ctags-%.tar.gz: ctags-%.tar.gz
	@ echo "---------- Building Vim tar ball"
	if [ -d vim ] ;then rm -fr vim ;fi
	mkdir -p vim
	cp -pr ctags-$* vim/ctags
	( cd vim/ctags ;\
	  mv README README.txt ;\
	  rm COPYING QUOTES ;\
	  echo "You can obtain a copy of the GNU General Public License from the GNU web" >> COPYING ;\
	  echo "site at http://www.gnu.org/copyleft/gpl.html, or from the Exuberant Ctags" >> COPYING ;\
	  echo "web site at http://darren.hiebert.com/ctags/gpl.html, or by writing to" >> COPYING ;\
	  echo "the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston," >> COPYING ;\
	  echo "MA 02111-1307  USA" >> COPYING ;\
	  chmod 644 COPYING ;\
	)
	cd vim; tar -zcf ../$@ ctags

$(CTAGS_DOSDIR)/ctags%: FORCE
	if [ -d $(CTAGS_DOSDIR)/ctags$* ] ;\
		then rm -fr $(CTAGS_DOSDIR)/ctags$*/* ;\
		else mkdir -p $(CTAGS_DOSDIR)/ctags$* ;\
	fi

dos1-%: $(DOS_FILES)
	for file in $^ ;do \
		unix2dos $${file} $(CTAGS_DOSDIR)/ctags$*/$${file} ;\
	done
	mv $(CTAGS_DOSDIR)/ctags$*/Makefile.amiga \
	   $(CTAGS_DOSDIR)/ctags$*/Makefile.ami

dos2-%: $(VERSION_FILES) ctags.man
	for file in $^ ;do \
		sed -e "s/@@VERSION@@/$*/" \
		    -e "s/@@LSMDATE@@/`date +'%d%b%y' | tr 'a-z' 'A-Z'`/" $${file} |\
			unix2dos > $(CTAGS_DOSDIR)/ctags`echo $*|sed 's/\.//g'`/$${file} ;\
	done

dos-%:
	@ echo "---------- Building MSDOS release directory"
	$(MAKE) $(CTAGS_DOSDIR)/ctags`echo $*|sed 's/\.//g'` \
			dos1-`echo $*|sed 's/\.//g'` dos2-$*

rpm-%: ctags-%.tar.gz ctags.spec
	@ echo "---------- Building RPM"
	cp -p ctags-$*.tar.gz $(RPM_ROOT)/SOURCES/
	sed -e "s/@@VERSION@@/$*/" ctags.spec > $(RPM_ROOT)/SPECS/ctags-$*.spec
	(cd $(RPM_ROOT)/SPECS; rpm -ba ctags-$*.spec)

ctags32-%: ctags-%.tar.gz
	@ echo "---------- Building DPMS binary for MSDOS"
	(cd ctags-$*; $(MAKE) -f ../Makefile ctags32.exe; mv ctags32.exe ..)
	rm -f $(CTAGS_DOSDIR)/ctags32.exe
	mcopy ctags32.exe $(CTAGS_DOSDIR)

#
# Prevent make from deleting these automatically
#
.PRECIOUS: ctags-%.tar.gz ctags-%.tar.Z vim-ctags-%.tar.gz

cleanrelease-%:
	rm -f ctags-$*.tar.gz vim-ctags-$*.tar.gz
	rm -fr ctags-$*
	rm -fr $(CTAGS_DOSDIR)/ctags`echo $*|sed 's/\.//g'`
	rm -f $(RPM_ROOT)/SOURCES/ctags-$*.tar.gz
	rm -f $(RPM_ROOT)/RPMS/i386/ctags-$*-1.i386.rpm
	rm -f $(RPM_ROOT)/SRPMS/ctags-$*-1.src.rpm
	rm -f $(RPM_ROOT)/SPECS/ctags-$*.spec

release-%: ctags-%.tar.gz ctags-%.tar.Z vim-ctags-%.tar.gz dos-% rpm-% ctags32-%
	@ echo "---------- Copying files to web archive"
	cp -p ctags-$*.tar.* $(WEB_ARCHIVE_DIR)
	cp -p $(RPM_ROOT)/RPMS/i386/ctags-$*-1.i386.rpm $(WEB_ARCHIVE_DIR)
	cp -p $(RPM_ROOT)/SRPMS/ctags-$*-1.src.rpm $(WEB_ARCHIVE_DIR)
	cp -p ctags-$*/ctags.lsm $(WEB_ARCHIVE_DIR)/ctags-$*.lsm
	chmod o+r $(WEB_ARCHIVE_DIR)/*
	@ echo "---------- Release $* completed"

#
# Dependency file generation
#
$(DEP_DIR)/%.d: %.c Makefile
	@ if [ ! -d $(DEP_DIR) ] ;then mkdir -p $(DEP_DIR) ;fi
	@ $(CC) -M $(DCFLAGS) $< | sed 's/\($*\.o\)\([ :]\)/\1 $(@F)\2/g' > $@


%.dd: %.c Makefile
	-@ $(CC) -M $(DCFLAGS) $<

#
# Compilation rules
#
%.o : %.c $(DEP_DIR)/%.d
	@ echo "-- Compiling $*.c"
	@ $(CC) $(CFLAGS) $(OPT) -Wuninitialized -O -c $<  $(REDIR)

%.i : %.c $(DEP_DIR)/%.d FORCE
	$(CC) $(DCFLAGS) -Wuninitialized -O -E $< | noblanks > $@ $(REDIR)

%.err: %.c
	@ $(CC) $(DCFLAGS) -Wuninitialized -O -c $<
	@ rm $*.o

%.gcov: %.bb
	@ gcov $*.c

# vi:ts=4 sw=4