summaryrefslogtreecommitdiff
path: root/fonts/utilities/mff-29/UNIX.mk
blob: 416f8b817e17397420b1a23852ff07d668c5c332 (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
# UNIX.mk 2.9.0 92/07/06 -- Makefile for mff -- UNIX version

#  make all 
#	to create progs this directory

#  make install IBIN=/usr/local/bin OPT=-O4 LDFLAGS=-s
#	to do "make all" and then copy progs into $(IBIN).

SUFFIX=
#  Suffix added to .o and .a file basenames

#  MACROS THAT GO INTO THE cc COMMAND

OPT=-O
NDEBUG=-DNDEBUG
CFLAGS=$(OPT)

RCDIR=/mclab/pdc/lib
#  RCDIR is the directory in which  the "system-wide" rc.mff file is 
#  to be found.  
#  The default -- if the above line is commented out --
#  is the value in config.h; by default /usr/local/lib.

CPPFLAGS=$(NDEBUG) $(MORECPPFLAGS)
LDFLAGS=

CP=cp -p
RM=rm -f

#  Tell "make" how to do compilations
#  -- removed Sun's silly -target option which confuses gcc.
COMPILE=$(CC) $(CFLAGS) $(CPPFLAGS) -c
LINK=$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)

.SUFFIXES: $(SUFFIX).o
.c$(SUFFIX).o:
	$(COMPILE) -o $@ $<
.c.o:
	$(COMPILE) -o $@ $<

IBIN=/mclab/pdc/tmp
ILIB=/mclab/pdc/tmp

########################################################################
#
#	TARGETS for the make command...

PROGS=mff.c searchpath.c
# source files for executables

LIBFILE=libargloop$(SUFFIX).a
LIB=$(LIBFILE)
.PRECIOUS: $(LIB)

MODULES=argloop.c al_file.c al_init.c findfile.c \
	strword.c stritem.c strdup.c fgetword.c error.c
# source files for modules in the argloop library

all: $(PROGS:.c=)
install: all install-lib
	$(CP) $(PROGS:.c=) $(IBIN)	
install-lib: $(LIB)
	$(CP) $(LIB) $(ILIB)

debug:
	$(MAKE) all SUFFIX=-g OPT=-g LDFLAGS= NDEBUG= "CC=gcc -Wall"
install-lib-g:
	$(MAKE) install-lib \
		SUFFIX=-g OPT=-g LDFLAGS= NDEBUG= "CC=gcc -Wall"
clean: 
	$(RM) *.ln *.o $(PROGS:.c=) *.a

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


MFF_o=mff$(SUFFIX).o assoc$(SUFFIX).o fx$(SUFFIX).o magstep$(SUFFIX).o
MFF_lib=$(LIB)
mff: $(MFF_o) $(LIB)
	$(LINK) -o mff $(MFF_o) $(MFF_lib)

SEARCHPATH_o=searchpath$(SUFFIX).o
SEARCHPATH_lib=$(LIB)
searchpath: $(SEARCHPATH_o) $(LIB)
	$(LINK) -o searchpath $(SEARCHPATH_o) $(SEARCHPATH_lib)

mff$(SUFFIX).o:	mff.c stdc.h config.h xstdio.h argloop.h fatal.h searchpath.h \
  		assoc.h fx.h strmisc.h magstep.h
assoc$(SUFFIX).o:	assoc.c stdc.h config.h xstdio.h strmisc.h assoc.h
fx$(SUFFIX).o:		fx.c stdc.h config.h xstdio.h fatal.h strmisc.h fx.h
magstep$(SUFFIX).o:	magstep.c stdc.h config.h magstep.h
searchpath$(SUFFIX).o:	searchpath.c xstdio.h stdc.h config.h searchpath.h

# semi-automatically-produced dependencies:

al_file.o:	al_file.c config.h xstdio.h stdc.h strmisc.h argloop.h
al_init.o:	al_init.c config.h xstdio.h stdc.h strmisc.h argloop.h
argloop.o:	argloop.c config.h xstdio.h stdc.h strmisc.h argloop.h
error.o:	error.c stdc.h config.h xstdio.h argloop.h fatal.h
fgetword.o:	fgetword.c xstdio.h stdc.h config.h
findfile.o:	findfile.c config.h strmisc.h stdc.h searchpath.h
strdup.o:	strdup.c fatal.h stdc.h config.h strmisc.h
stritem.o:	stritem.c strmisc.h stdc.h config.h
strword.o:	strword.c strmisc.h stdc.h config.h

config.h: config.x
	sed 's%/usr/local/lib%$(RCDIR)%' config.x > config.h

########################################################################
#	LIBRARY

# source for modules that go in the library

$(LIB): $(LIB)(argloop.o) $(LIB)(al_file.o) $(LIB)(al_init.o) \
		$(LIB)(findfile.o) $(LIB)(strword.o) $(LIB)(stritem.o) \
		$(LIB)(strdup.o) $(LIB)(fgetword.o) $(LIB)(error.o)

#  default rule
.c.a:
	$(COMPILE) -o $% $<
	$(AR) $(ARFLAGS) $@ $%
	$(RM) $%
	ranlib $@

#  I can't get @#$%& make to reliably ranlib after adding one or more
#  modules, so I have to make it do so every time.
#  COmment out this line on non-ranlib systems (Sys V?)

########################################################################
#	LINT SECTION (moan, moan)
#
#  sun's lint libraries often seem inconsistent with the manual pages 
#  and with reality.  
#
#  -n -lbsd -lm (BSD-compatibility check)
#    -- sprintf is given return type int not char * (!!)
#    -- void functions are given return type int
#    -- toupper is not defined
#  -lm -q (SunOS check)
#    -- errno is not defined

CFILES=$(PROGS)
LINTFILES=$(PROGS:.c=.ln)
LINTFLAGS=-abh
LINTLIB=llib-lmff.ln
LINTLIBS=-n -lbsd -lm
#LINTLIBS=-q -lm
LINTGREP=egrep -v 'constant (argument to NOT|in conditional context)'

lint: lint-mff lint-searchpath

lint-%: %.c $(LINTLIB)
	$(LINT.c) $*.c $(LINTLIB) $(LINTLIBS) | $(LINTGREP)

$(LINTLIB): $(MODULES:.c=.ln)
	$(LINT.c) -Cmff $(MODULES)