File: Makefile

package info (click to toggle)
lookup 1.08b-5
  • links: PTS
  • area: contrib
  • in suites: woody
  • size: 1,108 kB
  • ctags: 1,305
  • sloc: ansic: 12,634; makefile: 236; perl: 174; sh: 53
file content (278 lines) | stat: -rw-r--r-- 9,086 bytes parent folder | download | duplicates (5)
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
##
## If you have gcc, you should just be able to
##	make
##
## If you know the gcc is version 2, you can get better performance with
##	make gcc=gcc2
##
## If you don't have gcc, specify "gcc=" and tell what CC to use:
##	make gcc= CC=/bin/cc 
##
## You can add
##	warn=1
## to get compiler warnings. There are others as well... see below.
##
CC=gcc
CC_TRAD=$(CC) -traditional

## set to "gcc1", "gcc2" or leave blank
gcc=gcc2

## selecte exactly "0" (no) or "1" (yes) for the following
optimize=0
pedantic=0
kibishii=0
debug=1
warn=0
md=0

#MANPAGE_WIDTH=-r179

##
## If you know your include files (sys/ioctl.h specifically) are ANSIfied,
## you don't need to worry about COMPILE_WITH_TRAD, so you can comment
## it out if that's the case and you don't have a traditional compiler
## around.
##
#COMPILE_WITH_TRAD=termset_trad.o

RANLIB=/usr/bin/ranlib

##############################################################################
##############################################################################

##
## in these defines, _* are for when GCC is not used.
##                   gcc1_* for when gcc version 1 used.
##                   gcc2_* for when gcc version 2 used.
##

KIBISHII_1      = -DKIBISHII_DEBUG

gcc1_WARN_1     = -Wall -Wshadow -Wwrite-strings
gcc2_WARN_1     = -Wall -Wshadow -Wwrite-strings -Wno-implicit

## For generic non-GNU compilers. First digit is optimize, 2nd is debug
_OPTIMIZE_1_0     = -O -DFAST_REGEXEC -DNDEBUG
_OPTIMIZE_1_1     = -O -DFAST_REGEXEC
_OPTIMIZE_0_0     = -DFAST_REGEXEC -DNDEBUG
_OPTIMIZE_0_1     = -g

## For GNU Version 1.x compilers. First digit is optimize, 2nd is debug
gcc1_OPTIMIZE_1_0 = -O -g -DFAST_REGEXEC -DNDEBUG
gcc1_OPTIMIZE_1_1 = -O -g -DFAST_REGEXEC
gcc1_OPTIMIZE_0_0 = -DFAST_REGEXEC -DNDEBUG
gcc1_OPTIMIZE_0_1 = -g

## For GNU Version 2.x compilers. First digit is optimize, 2nd is debug
gcc2_OPTIMIZE_1_0 = -O2 -funroll-loops -g -DFAST_REGEXEC -DNDEBUG
gcc2_OPTIMIZE_1_1 = -O2 -g -DFAST_REGEXEC
gcc2_OPTIMIZE_0_0 = -DFAST_REGEXEC -DNDEBUG
gcc2_OPTIMIZE_0_1 = -g

gcc1_PEDANTIC_1   = -pedantic
gcc2_PEDANTIC_1   = -pedantic

gcc2_MD_1         =-MMD

## now use the above

PEDANTIC = $($(gcc)_PEDANTIC_$(pedantic))
WARNINGS = $($(gcc)_WARN_$(warn))
OPTIMIZE = $($(gcc)_OPTIMIZE_$(optimize)_$(debug))
KIBISHII = $(KIBISHII_$(kibishii))
MD       = $($(gcc)_MD_$(md))

OPTIONS=$(PEDANTIC) $(WARNINGS) $(OPTIMIZE) $(MD) $(KIBISHII)

##############################################################################

SHELL=/bin/sh

LOCAL_LIB_SRC=lib
LOCAL_LIB=jefflib.a

#OTHERLIBS=-lmach
LIBS= $(LOCAL_LIB) $(OTHERLIBS)

CFLAGS= $(OPTIONS) $(EXTRA) $(CFLAGS_EXTRA)

objs=lookup.o commands.o apply_regex.o eval.o

#all: _note_ lookup manual
all: lookup


LocalLibObs =       \
    virtfile.o      \
    euc.o           \
    fuzzkana.o      \
    index.o         \
    input.o         \
    jreadline.o     \
    jregex.o        \
    kanaid.o        \
    loadfile.o      \
    output.o        \
    replace.o       \
    romaji2kana.o   \
    std_romaji.o    \
    strsave.o       \
    termset.o       \
    xmalloc.o

$(LOCAL_LIB): $(LocalLibObs) $(COMPILE_WITH_TRAD)
	ar r $@ $?
	-if [ -f $(RANLIB) ]; then ranlib $@; else true; fi

$(COMPILE_WITH_TRAD):
	$(CC_TRAD) -c -o $@ $(CFLAGS) -I$(LOCAL_LIB_SRC)/ $(LOCAL_LIB_SRC)/$*.c

$(LocalLibObs):
	$(CC) -c -o $@ $(CFLAGS) -I$(LOCAL_LIB_SRC)/ $(LOCAL_LIB_SRC)/$*.c

_note_:
	-@echo ' '
	-@echo 'NOTE: "may be used uninitialized" warnings are OK in compile.'
	-@echo ' '

lookup: $(LOCAL_LIB) $(objs) version.c
	## Some systems (DGUX) have SH bugs that cause the link to die.
	## Can be fixed by wrapping in: csh -c "...."
	-@/bin/rm -f lookup.new
	$(CC) $(CFLAGS) -o lookup.new $(objs) version.c $(LIBS)
	/bin/mv -f lookup.new lookup

regextest: $(LOCAL_LIB) regextest.o
	$(CC) -o $@ regextest.o $(LOCAL_LIB)

commands.h: cmds.master
	perl -e 1 && perl cmds.master > temp.h && /bin/mv -f temp.h commands.h

lib/system.h: Makefile
	/bin/rm -f lib/system.h
	echo '/* this file generated by Makefile */'      > tmp;
	-echo '#ifndef __SYSTEM_H__ /*file wrapper*/'    >> tmp;
	-echo '#define __SYSTEM_H__'                     >> tmp;
	if [ -f /usr/include/strings.h ]; then\
		echo '#define _HAVE_STRINGS_H_'          >> tmp; \
	else true; fi
	if [ -f /usr/include/sys/termio.h ]; then\
		echo '#define _HAVE_SYS_TERMIO_H_'       >> tmp; \
	else true; fi
	if [ -f /usr/include/termio.h ]; then\
		echo '#define _HAVE_TERMIO_H_'       >> tmp; \
	else true; fi
	if [ -f /usr/include/sys/stdtypes.h ]; then\
		echo '#define _HAVE_SYS_STDTYPES_H_'     >> tmp; \
	else true; fi
	if [ -f /usr/include/sys/fcntl.h ]; then\
		echo '#define _HAVE_SYS_FCNTL_H_'        >> tmp; \
	else true; fi
	if [ -f /usr/include/fcntl.h ]; then\
		echo '#define _HAVE_FCNTL_H_'            >> tmp; \
	else true; fi
	-echo '#endif /* file wrapper */'                >> tmp;
	mv tmp lib/system.h

make.sh: realclean
	@echo ':# script to make lookup'                               > tmp
	@echo '## Can set CC= and CFLAGS= on the command line, just as with make' >> tmp
	@echo 'CC="gcc"'                                             >> tmp
	@echo 'CFLAGS="-O -DFAST_REGEXEC -DNDEBUG"'                  >> tmp
	@echo '#####################################################'>> tmp
	@echo 'set -ex'                                              >> tmp
	@echo 'eval $$@'                                             >> tmp
	$(MAKE) --silent -n gcc= CC='[ -s $$@ ]||$$$$CC' CFLAGS='$$$$CFLAGS' >> tmp
	/bin/mv tmp make.sh
	chmod +x make.sh

##
## We use man.tmp so that lookup.man won't be erased if jnroff or jconv
## fails (such as if it's not even found).
##
manual: lookup.man.euc lookup.man.jis lookup.man.sjs

lookup.man.euc: doc/lookup.man doc/*.so
	@echo
	@echo "NOTE : if jnroff isn't found, manuals won't be remade."
	@echo
	cd doc; jnroff $(MANPAGE_WIDTH) -man lookup.man > man.tmp
	mv doc/man.tmp lookup.man.euc

lookup.man.jis: lookup.man.euc
	jconv -ie -oj < lookup.man.euc > man.tmp
	mv man.tmp lookup.man.jis

lookup.man.sjs: lookup.man.euc
	jconv -ie -os < lookup.man.euc > man.tmp
	mv man.tmp lookup.man.sjs

## The following is JIS, but without any highlighting.
lookup.man.raw: lookup.man.jis
	sed -e 's/.//g' < lookup.man.jis > man.tmp
	mv man.tmp lookup.man.raw

tidy:
	-@echo dummy > dummy~
	/bin/rm -f .*~ *~ */*~ core a.out man.tmp doc/*.bak

clean: tidy
	-@echo dummy > dummy.o
	/bin/rm -f \#* *.o *.d doc/#* $(LOCAL_LIB) lib/system.h

realclean: clean
	-@echo dummy > lookup.man.xxx
	/bin/rm -f lookup lookup.man.* commands.h make.sh

##################################################################

apply_regex.o: apply_regex.c lib/config.h lib/output.h lib/assert.h \
 lib/index.h lib/system.h lib/packed_list.h lib/MemItem.h \
 lib/xmalloc.h lib/virtfile.h lib/loadfile.h lib/longlinenote.h \
 lib/jregex.h lib/replace.h lookup.h
commands.o: commands.c lib/system.h lib/config.h lib/assert.h \
 lib/jreadline.h lib/jregex.h lib/loadfile.h lib/longlinenote.h \
 lib/xmalloc.h lib/index.h lib/packed_list.h lib/MemItem.h \
 lib/output.h lib/virtfile.h lib/replace.h lib/strsave.h lib/euc.h \
 lookup.h eval.h commands.h
euc.o: lib/euc.c lib/config.h lib/euc.h
eval.o: eval.c lib/config.h lib/jregex.h lib/output.h lookup.h \
 lib/virtfile.h lib/assert.h eval.h
fuzzkana.o: lib/fuzzkana.c lib/config.h lib/assert.h lib/output.h \
 lib/fuzzkana.h lib/kanaid.h
index.o: lib/index.c lib/config.h lib/system.h lib/assert.h \
 lib/output.h lib/index.h lib/packed_list.h lib/MemItem.h \
 lib/xmalloc.h lib/virtfile.h
input.o: lib/input.c lib/config.h
jreadline.o: lib/jreadline.c lib/config.h lib/assert.h lib/output.h \
 lib/jreadline.h lib/strsave.h lib/input.h lib/xmalloc.h lib/euc.h \
 lib/system.h
jregex.o: lib/jregex.c lib/config.h lib/assert.h lib/jregex.h \
 lib/output.h lib/euc.h
kanaid.o: lib/kanaid.c lib/config.h lib/kanaid.h
loadfile.o: lib/loadfile.c lib/config.h lib/assert.h lib/xmalloc.h \
 lib/strsave.h lib/system.h lib/loadfile.h lib/longlinenote.h \
 lib/index.h lib/packed_list.h lib/MemItem.h lib/output.h \
 lib/virtfile.h
lookup.o: lookup.c lib/config.h lib/assert.h lib/output.h \
 lib/fuzzkana.h lib/loadfile.h lib/longlinenote.h lib/xmalloc.h \
 lib/index.h lib/system.h lib/packed_list.h lib/MemItem.h \
 lib/virtfile.h lib/romaji2kana.h lib/jregex.h lib/strsave.h \
 lib/replace.h lib/input.h lookup.h lib/jreadline.h
output.o: lib/output.c lib/config.h lib/assert.h lib/input.h \
 lib/output.h
replace.o: lib/replace.c lib/config.h lib/assert.h lib/jregex.h \
 lib/xmalloc.h lib/replace.h
romaji2kana.o: lib/romaji2kana.c lib/config.h lib/assert.h \
 lib/romaji2kana.h lib/kanaid.h
std_romaji.o: lib/std_romaji.c lib/config.h lib/system.h \
 lib/romaji2kana.h lib/jreadline.h lib/strsave.h lib/xmalloc.h
strsave.o: lib/strsave.c lib/xmalloc.h lib/strsave.h
termset.o: lib/termset.c lib/config.h lib/system.h
termset_trad.o: lib/termset_trad.c lib/termset.c lib/config.h \
 lib/system.h
version.o: version.c
virtfile.o: lib/virtfile.c lib/config.h lib/output.h lib/xmalloc.h \
 lib/strsave.h lib/virtfile.h
xmalloc.o: lib/xmalloc.c lib/xmalloc.h