1# Copyright (c) 1991 Bell Communications Research, Inc. (Bellcore)
2#
3# Permission to use, copy, modify, and distribute this material
4# for any purpose and without fee is hereby granted, provided
5# that the above copyright notice and this permission notice
6# appear in all copies, and that the name of Bellcore not be
7# used in advertising or publicity pertaining to this
8# material without the specific, prior written permission
9# of an authorized representative of Bellcore.  BELLCORE
10# MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY
11# OF THIS MATERIAL FOR ANY PURPOSE.  IT IS PROVIDED "AS IS",
12# WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
13#
14
15# System V users may change the following to remove the "-s" and all will still work.
16LN = ln -s
17
18RM = rm
19# To shut rm up on SGI machines (where symlinks have mode 0000)
20# RM = rm -f
21
22# How to run Make
23MAKE = make
24
25# How to copy files
26CP = cp
27
28# How to compile C programs
29CC = cc
30
31# You may also want to change the CFLAGS variable, which will be passed on
32# to all subdirectories.    If you do that, the changes will only work right if you
33# start your make in the top-level directory, not if you start in a subdirectory.
34
35# Note that the FOOBAR hack is to get -Bstatic on sun4's but nowhere else.
36#It is very ugly, but what can you do?
37FOOBAR-sun4=-Bstatic
38
39STATICFLAG=FOOBAR${HOST_ARCH}
40
41CFLAGS = -g -I.  ${$(STATICFLAG)}
42# The following is better if you want to make sure you run with SYSV defined
43# CFLAGS = -g -I.  ${$(STATICFLAG)}  -DSYSV
44# Also, for SGI Irix, compile in K&R mode
45#CFLAGS = -g -I.  ${$(STATICFLAG)}  -DSYSV -cckr
46
47# You may have to include other libraries to the link to get things like
48# gethostname() resolved or use shared libraries.  This is done with the
49# LDLIBS variable.
50#
51# For Sun and BSD systems, the following should work...
52LDLIBS =
53# On BSD 4.4 systems, you will need the following
54# LDLIBS = -lcompat
55# On SGI machines, we need -lsun for getpw...(), and -lc_s saves some space.
56# LDLIBS = -lsun -lc_s
57# ISC SysVr3.2.2 has a shared C library and requires libinet.a to resolve
58# gethostname() references.
59# LDLIBS = -linet -lc_s
60
61#
62# This is where config.h lives
63CONFIGDIR = .
64
65# This is how binaries should be installed
66#
67# If you are installing on the DEC Alpha running OSF/1, the install
68# command uses different arguments than on other platforms.  You
69# should either define INSTALL as cp, or modify all the uses of
70# the install command in the makefile to be
71#
72#	install -s -c $(LOCALBINDIR) $$file
73#
74#INSTALL = cp
75INSTALL = install -c -s
76
77# Root of installation tree
78INSTROOT = /usr/local
79#
80# This is where binaries should be copied
81LOCALBINDIR = ${INSTROOT}/bin
82
83# This is where man pages should be copied, and their extensions
84MAN1DIR = ${INSTROOT}/man/man1
85MAN1EXT = 1
86MAN4DIR = ${INSTROOT}/man/man4
87MAN4EXT = 4
88
89# Sets the font suffix your version of X uses - snf for X11R4, pcf for X11R5
90# FONTSUFFIX=snf
91FONTSUFFIX=pcf
92
93# This is where the mailcap file should be put
94MAILCAPDIR = ${INSTROOT}/etc
95
96# This helps with the "for" constructs below on some platforms:
97SHELL=/bin/sh
98
99install: basics
100
101basics::
102	(cd metamail ; $(MAKE)  CONFIGDIR=../${CONFIGDIR}  CFLAGS="${CFLAGS}" CC="${CC}"  LDLIBS="${LDLIBS}")
103	-${RM} bin/metamail
104	(cd bin; ${LN} ../metamail/metamail metamail)
105	-${RM} bin/mmencode
106	(cd bin; ${LN} ../metamail/mmencode mmencode)
107	-${RM} bin/mimencode
108	(cd bin; ${LN} ../metamail/mmencode mimencode)
109	-${RM} man/mimencode.1
110	(cd man; ${LN} ../man/mmencode.1 mimencode.1)
111	-${RM} bin/mailto
112	(cd bin; ${LN} ../metamail/mailto mailto)
113	-${RM} bin/splitmail
114	(cd bin; ${LN} ../metamail/splitmail splitmail)
115	(cd richmail ; $(MAKE)  CONFIGDIR=../${CONFIGDIR}  CFLAGS="${CFLAGS}" CC="${CC}"  LDLIBS="${LDLIBS}")
116	-${RM} bin/richtext
117	(cd bin; ${LN} ../richmail/richtext richtext)
118	-${RM} bin/richtoatk
119	(cd bin; ${LN} ../richmail/richtoatk richtoatk)
120	(cd fonts ; $(MAKE)  CONFIGDIR=../${CONFIGDIR}  CFLAGS="${CFLAGS}" CC="${CC}"   LDLIBS="${LDLIBS}" FONTSUFFIX="${FONTSUFFIX}")
121	-${RM} bin/shownonascii
122	(cd bin; ${LN} ../fonts/shownonascii shownonascii)
123	-${RM} bin/mailto-hebrew
124	(cd bin; ${LN} ../fonts/mailto-hebrew mailto-hebrew)
125
126install-all: basics
127	@(cd bin; 				\
128	for file in *; 				\
129	do 					\
130	    target=$(LOCALBINDIR)/$$file; 	\
131	    echo "installing binary $$target";	\
132	    ${INSTALL} $$file $$target; 	\
133	done)
134	@(cd man;				\
135	for file in *.1;			\
136	do 					\
137	    target=$(MAN1DIR)/`basename $$file .1`.$(MAN1EXT); \
138	    echo "installing man page $$target";\
139	    ${CP} $$file $$target; 		\
140	done)
141	@(cd man;				\
142	for file in *.4;			\
143	do 					\
144	    target=$(MAN4DIR)/`basename $$file .4`.$(MAN4EXT); \
145	    echo "installing man page $$target";\
146	    ${CP} $$file $$target; 		\
147	done)
148	@echo "Renaming old mailcap file to $(MAILCAPDIR)/mailcap.old
149	-mv $(MAILCAPDIR)/mailcap $(MAILCAPDIR)/mailcap.old
150	@echo "installing file $(MAILCAPDIR)/mailcap"
151	${CP} mailcap $(MAILCAPDIR)
152
153uninstall-all:
154	@(cd bin; 				\
155	for file in *; 				\
156	do 					\
157	    target=$(LOCALBINDIR)/$$file; 	\
158	    echo "rm-ing binary $$target";\
159	    ${RM} $(LOCALBINDIR)/$$file; 	\
160	done)
161	@(cd man;				\
162	for file in *.1;			\
163	do 					\
164	    target=$(MAN1DIR)/`basename $$file .1`.$(MAN1EXT); \
165	    echo "rm-ing man page $$target";\
166	    ${RM} $$target; 		\
167	done)
168	@(cd man;				\
169	for file in *.4;			\
170	do 					\
171	    target=$(MAN4DIR)/`basename $$file .4`.$(MAN4EXT); \
172	    echo "rm-ing man page $$target";\
173	    ${RM} $$target; 		\
174	done)
175	@echo "rm-ing file $(MAILCAPDIR)/mailcap"
176	@${RM} $(MAILCAPDIR)/mailcap
177
178clean:
179	-${RM} -rf *.BAK
180	(cd metamail ; $(MAKE) clean)
181	(cd richmail ; $(MAKE) clean)
182	(cd fonts ; $(MAKE) FONTSUFFIX="${FONTSUFFIX}" clean)
183
184cleanbin:
185	-${RM} bin/metamail
186	-${RM} bin/mmencode
187	-${RM} bin/mimencode
188	-${RM} bin/mailto
189	-${RM} bin/splitmail
190	-${RM} bin/richtext
191	-${RM} bin/richtoatk
192	-${RM} bin/shownonascii
193	-${RM} bin/mailto-hebrew
194
195cleanman:
196	-${RM} man/mimencode.1
197
198clobber: clean cleanambin cleanbin cleanman
199