summaryrefslogtreecommitdiff
path: root/Build/source/texk/detex/detex-src/Makefile
blob: 5358b2910400398c888cc8583a9ed748ba7dc9c3 (plain)
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
# Copyright (c) 1986-2007 Purdue University
# All rights reserved.
# 
# Developed by:  Daniel Trinkle
#                Department of Computer Science, Purdue University
#                http://www.cs.purdue.edu/
# 
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal with the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
# 
# o Redistributions of source code must retain the above copyright
#   notice, this list of conditions and the following disclaimers.
# 
# o Redistributions in binary form must reproduce the above copyright
#   notice, this list of conditions and the following disclaimers in the
#   documentation and/or other materials provided with the distribution.
# 
# o Neither the names of Daniel Trinkle, Purdue University, nor the
#   names of its contributors may be used to endorse or promote products
#   derived from this Software without specific prior written
#   permission.
# 
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR
# ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
# CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
#
#
#	Makefile for detex and delatex
#
# Detex is a program to remove TeX and LaTeX constructs from text source.

UNAME_S := $(shell uname -s)

# Installation directory
#
DESTDIR	= /usr/local/bin

# Specify you favorite compiler
#
#CC	= gcc

# Compile time flags, just uncomment the necessary lines
# Some say GNU make does not correctly handle += -- you may have to use :=
#
DEFS	=
#
# Add -traditional for GNU cc on ISC 386/ix system and possibly others
# (reported by pinard@iro.umontreal.ca)
#
#DEFS	+= ${DEFS} -traditional
#
# Add -DHAVE_STRING_H for the SysV string manipulation routines
#
#DEFS	+= ${DEFS} -DHAVE_STRING_H
#
# Add -DMAXPATHLEN=<length> if it is not defined in /usr/include/sys/param.h
#
#DEFS	+= ${DEFS} -DMAXPATHLEN=1024
#
# Add -DNO_MALLOC_DECL if your system does not like the malloc() declaration
# in detex.l (reported by pinard@iro.umontreal.ca)
#
#DEFS	+= ${DEFS} -DNO_MALLOC_DECL
#
CFLAGS	= -O ${DEFS} -Wall

# Use your favorite lexical scanner
#
#LEX	= lex
LEX	= flex

#LFLAGS	= -8 -C

# scanner library
#
LEXLIB	= -lfl
ifeq ($(UNAME_S),Darwin)
	LEXLIB	= -ll
endif

LPR	= lpr -p

# Program names
#
PROGS	= detex delatex

# Header files
#
HDR	= detex.h

# Sources
#
SRC	= detex.l

# Objects for various programs
#
D_OBJ	= detex.o

VERSION = 2.8.3

all:	${PROGS}

detex: ${D_OBJ}
	${CC} ${CFLAGS} -o $@ ${D_OBJ} ${LEXLIB}

delatex: detex
	cp detex delatex

detex.c: detex.l
	${LEX} ${LFLAGS} detex.l
	mv lex.yy.c detex.c

man-page:
	troff -man detex.1l

# If you want detex available as delatex, uncomment the last two lines of
# this target
install: all
	rm -f ${DESTDIR}/detex
	install -c -m 775 -g staff -s detex ${DESTDIR}
	install detex.1l /usr/local/share/man/man1
#	rm -f ${DESTDIR}/delatex
#	ln ${DESTDIR}/detex ${DESTDIR}/delatex

uninstall:
	rm -f ${DESTDIR}/detex
	rm -f ${DESTDIR}/delatex
	rm -f /usr/local/share/man/man1/detex.*

clean:
	-rm -f a.out core *.s *.o ERRS errs .,* .emacs_[0-9]*
	-rm -f ${PROGS} xxx.l lex.yy.c detex.c
	-rm -f *.tar.bz2

print:	${HDR} ${SRC}
	${LPR} Makefile ${HDR} ${SRC}

test: all
	./test.pl

run: delatex
	./delatex in > out.txt

package: clean detex.c
	tar cjfv opendetex-${VERSION}.tar.bz2 ChangeLog COPYRIGHT detex.* INSTALL Makefile README

# Dependencies
#
detex.c: detex.h
detex.c: detex.l