File: makefile.orig

package info (click to toggle)
sloccount 2.26-5.2
  • links: PTS
  • area: main
  • in suites: bookworm, bullseye, buster, sid, trixie
  • size: 1,592 kB
  • ctags: 1,072
  • sloc: perl: 2,909; ansic: 610; sh: 557; lex: 254; makefile: 252; ruby: 110; haskell: 32; cobol: 27; php: 22; pascal: 10; xml: 7; f90: 6; fortran: 6; cs: 5
file content (222 lines) | stat: -rw-r--r-- 6,045 bytes parent folder | download | duplicates (6)
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
# Makefile for SLOCCount.
# (C) Copyright David A. Wheeler 2000-2002.
# Licensed under the GPL; see sloccount.html for license information.
# My thanks to John Clezy, who provided the modifications to this makefile
# to make sloccount work on Windows using Cygwin.


# You may need to change the following options to install on your machine:

# Set this for where to store the man pages and executables.
# If you want to store this as part of an official distribution,
# change this to "/usr":
PREFIX=/usr/local

# Set "EXE_SUFFIX" to ".exe" if you're running on Windows, like this:
# EXE_SUFFIX=.exe
EXE_SUFFIX=

# Set this to your C compiler, if it's not "gcc"; a likely alternative is "cc".
# The "-Wall" option turns on warnings in gcc.  gcc users might also want
# to consider using "-Werror", which turns warnings into errors.
CC=gcc -Wall

# Set this to the name of your "install" program.  On some systems,
# "install -C" would be useful (so unchanged files won't be modified),
# but not all systems support this install option.  "Install" should work
# for any Unix-like system as well as for Cygwin.
# "INSTALL_A_DIR" is the command to create a directory in the first place.
INSTALL=install
INSTALL_A_DIR=$(INSTALL) -d

# Set this to the name of the program to create RPMs.
# This works for Red Hat Linux 8.0:
RPMBUILD=rpmbuild -ba
# This works for Red Hat Linux 7.X and below:
# RPMBUILD=rpm -ba


# From here on, nothing should need changing unless you're
# changing the code itself.

# To change the version #, change VERSION here, sloccount.spec, and
# sloccount.html.
# Note to self: to redistribute, do this:
# make distribute; su; make rpm; (test as desired);
# rpm -e sloccount; ^D; make my_install; send to web site.


NAME=sloccount
VERSION=2.20
RPM_VERSION=1
ARCH=i386
VERSIONEDNAME=$(NAME)-$(VERSION)
INSTALL_DIR=$(PREFIX)/bin
MAN_DIR=$(PREFIX)/share/man
MAN_DIR_MAN1=$(MAN_DIR)/man1
DOC_DIR=$(PREFIX)/share/doc/$(VERSIONEDNAME)-$(RPM_VERSION)
POSTED_DIR=/home/dwheeler/dwheeler.com/sloccount

COMPILED_EXECUTABLES= \
   c_count$(EXE_SUFFIX) \
   java_count$(EXE_SUFFIX) \
   lexcount1$(EXE_SUFFIX) \
   pascal_count$(EXE_SUFFIX) \
   php_count$(EXE_SUFFIX) \
   jsp_count$(EXE_SUFFIX)

EXECUTABLES= \
   ada_count \
   asm_count \
   awk_count \
   break_filelist \
   cobol_count \
   compute_all \
   compute_sloc_lang \
   count_extensions \
   count_unknown_ext \
   csh_count \
   exp_count \
   fortran_count \
   generic_count \
   get_sloc \
   get_sloc_details \
   haskell_count \
   lex_count \
   lisp_count \
   make_filelists \
   makefile_count \
   ml_count \
   modula3_count \
   objc_count \
   perl_count \
   print_sum \
   python_count \
   ruby_count \
   sed_count \
   sh_count \
   show_filecount \
   sloccount \
   sql_count \
   tcl_count \
   $(COMPILED_EXECUTABLES)

MANPAGES=sloccount.1.gz

MYDOCS=sloccount.html README TODO ChangeLog


all: $(COMPILED_EXECUTABLES)

lexcount1$(EXE_SUFFIX): lexcount1.c
	$(CC) lexcount1.c -o lexcount1$(EXE_SUFFIX)

c_count$(EXE_SUFFIX): c_count.c
	$(CC) c_count.c -o c_count$(EXE_SUFFIX)

php_count$(EXE_SUFFIX): php_count.c
	$(CC) php_count.c -o php_count$(EXE_SUFFIX)

pascal_count.c: pascal_count.l driver.c driver.h
	flex -Cfe -t pascal_count.l > pascal_count.c

pascal_count$(EXE_SUFFIX): pascal_count.c
	$(CC) pascal_count.c -o pascal_count$(EXE_SUFFIX)

jsp_count.c: jsp_count.l driver.c driver.h
	flex -Cfe -t jsp_count.l > jsp_count.c

jsp_count$(EXE_SUFFIX): jsp_count.c
	$(CC) jsp_count.c -o jsp_count$(EXE_SUFFIX)

sloccount.1.gz: sloccount.1
	gzip -c sloccount.1 > sloccount.1.gz

# Currently "java_count" is the same as "c_count":
java_count$(EXE_SUFFIX): c_count$(EXE_SUFFIX)
	cp -p c_count$(EXE_SUFFIX) java_count$(EXE_SUFFIX)

# This is USC's code counter, not built by default:
c_lines: C_LINES.C
	$(CC) C_LINES.C -o c_lines$(EXE_SUFFIX)


install_programs: all
	$(INSTALL) $(EXECUTABLES) $(INSTALL_DIR)

uninstall_programs:
	cd $(INSTALL_DIR) && rm -f $(EXECUTABLES)

install_man:
	$(INSTALL_A_DIR) $(MAN_DIR_MAN1)
	$(INSTALL) $(MANPAGES) $(MAN_DIR_MAN1)

uninstall_man:
	cd $(MAN_DIR_MAN1) && rm -f $(MANPAGES)

install_docs: install_man
	$(INSTALL_A_DIR) $(DOC_DIR)
	$(INSTALL) $(MYDOCS) $(DOC_DIR)

uninstall_docs:
	cd $(DOC_DIR) && rm -f $(MYDOCS) && rmdir $(DOC_DIR)


install: install_programs install_man install_docs

uninstall: uninstall_programs uninstall_docs uninstall_man


clean:
	-rm -f $(COMPILED_EXECUTABLES) core sloccount.1.gz

phptest: php_count
	./php_count *.php
	./php_count /usr/share/php/*.php
	./php_count /usr/share/php/*/*.php

# "make distribute" creates the tarball.


distribute: clean $(MANPAGES)
	rm -f sloccount-$(VERSION).tgz
	rm -f sloccount-$(VERSION).tar.gz
	mkdir 9temp
	cp -pr [A-Za-z]* 9temp
	mv 9temp $(VERSIONEDNAME)
	rm -f $(VERSIONEDNAME)/*.tgz
	rm -f $(VERSIONEDNAME)/*.tar.gz
	rm -f $(VERSIONEDNAME)/*.rpm
#	rm -f $(VERSIONEDNAME)/*.1.gz
	rm -f $(VERSIONEDNAME)/C_LINES.C
	rm -f $(VERSIONEDNAME)/java_lines.c
	rm -f $(VERSIONEDNAME)/c_lines
	tar -cvf - $(VERSIONEDNAME)/* | \
		gzip --best > $(VERSIONEDNAME).tar.gz
	chown --reference=README $(VERSIONEDNAME).tar.gz
	chmod a+rX *
	rm -fr $(VERSIONEDNAME)

my_install: distribute
	chmod a+rX *
	cp -p sloccount-$(VERSION).tar.gz $(POSTED_DIR)
	cp -p sloccount.html $(POSTED_DIR)
	cp -p ChangeLog $(POSTED_DIR)
	cp -p TODO $(POSTED_DIR)
	cp -p /usr/src/redhat/RPMS/$(ARCH)/$(VERSIONEDNAME)-$(RPM_VERSION)*.rpm $(POSTED_DIR)
	cp -p /usr/src/redhat/SRPMS/$(VERSIONEDNAME)-$(RPM_VERSION)*.src.rpm $(POSTED_DIR)
	

rpm: distribute
	cp $(VERSIONEDNAME).tar.gz /usr/src/redhat/SOURCES
	cp sloccount.spec /usr/src/redhat/SPECS
	cd /usr/src/redhat/SPECS
	# Uninstall current sloccount if any; ignore errors if not installed.
	-rpm -e sloccount
	$(RPMBUILD) sloccount.spec
	chmod a+r /usr/src/redhat/RPMS/$(ARCH)/$(VERSIONEDNAME)-$(RPM_VERSION)*.rpm
	chmod a+r /usr/src/redhat/SRPMS/$(VERSIONEDNAME)-$(RPM_VERSION)*.src.rpm
	rpm -ivh /usr/src/redhat/RPMS/$(ARCH)/$(VERSIONEDNAME)-$(RPM_VERSION)*.rpm
	echo "Use rpm -e $(NAME) to remove the package"