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
|
$NetBSD: patch-aj,v 1.3 1999/10/08 21:18:34 jlam Exp $
--- pnm/Makefile.orig Mon Jan 31 11:47:32 1994
+++ pnm/Makefile Fri Oct 8 13:33:59 1999
@@ -10,27 +10,30 @@
# implied warranty.
# Default values, usually overridden by top-level Makefile.
-#CC = cc
-CC = gcc -ansi -pedantic -fcombine-regs -fpcc-struct-return
+CC = gcc
+#CC = gcc -ansi -pedantic -fcombine-regs -fpcc-struct-return
#CFLAGS = -O
-CFLAGS = -g
+CFLAGS = -O2
#CFLAGS = -g -O
TIFFDEF = -DLIBTIFF
-TIFFINC = -I../libtiff
-TIFFLIB = ../libtiff/libtiff.a
+TIFFINC = -I$(LOCALBASE)/include
+TIFFLIB = -Wl,-R$(LOCALBASE)/lib -L$(LOCALBASE)/lib -ltiff -ljpeg -lz
TIFFBINARIES = tifftopnm pnmtotiff
TIFFOBJECTS = tifftopnm.o pnmtotiff.o
-#LDFLAGS = -s
-LDFLAGS =
-INSTALLBINARIES = /usr/new/pbm
+PNGLIB = -Wl,-R$(LOCALBASE)/lib -L$(LOCALBASE)/lib -lpng -lz
+LDFLAGS = -s
+#LDFLAGS =
+INSTALLBINARIES = $(PREFIX)/bin
INSTALLSCRIPTS = $(INSTALLBINARIES)
-INSTALLMANUALS1 = /usr/man/man1
+INSTALLMANUALS1 = $(PREFIX)/man/man1
SUFFIXMANUALS1 = 1
-INSTALLMANUALS3 = /usr/man/man3
+INSTALLMANUALS3 = $(PREFIX)/man/man3
SUFFIXMANUALS3 = 3
-INSTALLMANUALS5 = /usr/man/man5
+INSTALLMANUALS5 = $(PREFIX)/man/man5
SUFFIXMANUALS5 = 5
-MANCP = cp
+MANCP = install -c -m 0644
+INSTALLLIBS = $(PREFIX)/lib
+INSTALLDEFS = $(PREFIX)/include
PPMDIR = ../ppm
INCLUDEPPM = -I$(PPMDIR)
@@ -54,48 +57,52 @@
INCLUDE = -I.. $(INCLUDEPPM) $(INCLUDEPGM) $(INCLUDEPBM)
ALLCFLAGS = $(CFLAGS) $(INCLUDE) $(TIFFDEF) $(TIFFINC)
LIBPNM = libpnm.a
+DEFPNM = pnm.h
PORTBINARIES = fitstopnm giftopnm \
pnmalias pnmarith pnmcat pnmcomp pnmconvol pnmcrop \
pnmcut pnmdepth pnmenlarge pnmfile pnmflip pnmhistmap \
pnminvert pnmnoraw pnmpad pnmpaste \
pnmtile pnmtoddif pnmtofits pnmtops pnmtorast \
- pnmtosgi pnmtosir pnmtoxwd \
- rasttopnm sgitopnm sirtopnm xwdtopnm zeisstopnm
+ pnmtorle pnmtosgi pnmtosir pnmtoxwd \
+ rasttopnm rletopnm sgitopnm sirtopnm xwdtopnm zeisstopnm \
+ pnmsmooth pnmhisteq
MATHBINARIES = pnmgamma pnmnlfilt pnmrotate pnmscale pnmshear
-BINARIES = $(PORTBINARIES) $(MATHBINARIES) $(TIFFBINARIES)
-SCRIPTS = anytopnm pnmindex pnmmargin pnmsmooth pstopnm
+PNGBINARIES = pngtopnm pnmtopng
+BINARIES = $(PORTBINARIES) $(MATHBINARIES) $(PNGBINARIES) $(TIFFBINARIES)
+SCRIPTS = anytopnm pnmindex pnmmargin pstopnm
PORTOBJECTS = fitstopnm.o giftopnm.o \
pnmalias.o pnmarith.o pnmcat.o pnmcomp.o pnmconvol.o pnmcrop.o \
pnmcut.o pnmdepth.o pnmenlarge.o pnmfile.o pnmflip.o pnmhistmap.o \
- pnminvert.o pnmnoraw.o pnmpad.o pnmpaste.o \
+ pnmhisteq.o pnminvert.o pnmnoraw.o pnmpad.o pnmpaste.o\
pnmtile.o pnmtoddif.o pnmtofits.o pnmtops.o pnmtorast.o \
pnmtosgi.o pnmtosir.o pnmtoxwd.o \
rasttopnm.o sgitopnm.o sirtopnm.o xwdtopnm.o zeisstopnm.o \
+ pnmsmooth.o pnmhisteq.o \
pnmgamma.o pnmnlfilt.o pnmrotate.o pnmscale.o pnmshear.o
-OBJECTS = $(PORTOBJECTS) $(TIFFOBJECTS)
+OBJECTS = $(PORTOBJECTS)
MANUALS1 = $(BINARIES) $(SCRIPTS)
MANUALS3 = libpnm
MANUALS5 = pnm
-#all: binaries
-all: merge
-#install: install.bin
-install: install.merge
+all: binaries
+#all: merge
+install: install.bin
+#install: install.merge
binaries: $(BINARIES)
install.bin: binaries $(SCRIPTS)
cd $(INSTALLBINARIES) ; rm -f $(BINARIES)
- cp $(BINARIES) $(INSTALLBINARIES)
+ install -c -s -m 0755 $(BINARIES) $(INSTALLBINARIES)
cd $(INSTALLSCRIPTS) ; rm -f $(SCRIPTS)
- cp $(SCRIPTS) $(INSTALLSCRIPTS)
- cd $(INSTALLSCRIPTS) ; chmod +x $(SCRIPTS)
-
+ install -c -m 0755 $(SCRIPTS) $(INSTALLSCRIPTS)
+ install -c -m 0644 $(LIBPNM) $(INSTALLLIBS)
+ install -c -m 0644 $(DEFPNM) $(INSTALLDEFS)
merge: pnmmerge
pnmmerge: pnmmerge.c $(OBJECTS) $(LIBPNM) $(LIBPPM) $(LIBPGM) $(LIBPBM)
@@ -128,16 +135,22 @@
# Rules for plain programs.
-$(PORTBINARIES) $(TIFFBINARIES): pnm.h $(DEFPPM) $(DEFPGM) $(DEFPBM) $(LIBPNM) $(LIBPPM) $(LIBPGM) $(LIBPBM) $(TIFFLIB)
- $(CC) $(ALLCFLAGS) $(LDFLAGS) -o $@ $@.c $(LIBPNM) $(LIBPPM) $(LIBPGM) $(LIBPBM) $(TIFFLIB)
+$(PORTBINARIES): $(DEFPNM) $(DEFPPM) $(DEFPGM) $(DEFPBM) $(LIBPNM) $(LIBPPM) $(LIBPGM) $(LIBPBM)
+ $(CC) $(ALLCFLAGS) $(LDFLAGS) -o $@ $@.c $(LIBPNM) $(LIBPPM) $(LIBPGM) $(LIBPBM)
+
+$(PNGBINARIES): $(DEFPNM) $(DEFPPM) $(DEFPGM) $(DEFPBM) $(LIBPNM) $(LIBPPM) $(LIBPGM) $(LIBPBM)
+ $(CC) $(ALLCFLAGS) $(LDFLAGS) -o $@ $@.c $(LIBPNM) $(LIBPPM) $(LIBPGM) $(LIBPBM) $(PNGLIB) -lm
+
+$(TIFFBINARIES): $(DEFPNM) $(DEFPPM) $(DEFPGM) $(DEFPBM) $(LIBPNM) $(LIBPPM) $(LIBPGM) $(LIBPBM)
+ $(CC) $(ALLCFLAGS) $(LDFLAGS) -o $@ $@.c $(LIBPNM) $(LIBPPM) $(LIBPGM) $(LIBPBM) $(TIFFLIB) -lm
# Rule for math-dependent programs.
-$(MATHBINARIES): pnm.h $(DEFPPM) $(DEFPGM) $(DEFPBM) $(LIBPNM) \
+$(MATHBINARIES): $(DEFPNM) $(DEFPPM) $(DEFPGM) $(DEFPBM) $(LIBPNM) \
$(LIBPPM) $(LIBPGM) $(LIBPBM)
$(CC) $(ALLCFLAGS) $(LDFLAGS) -o $@ $@.c -lm $(LIBPNM) $(LIBPPM) $(LIBPGM) $(LIBPBM)
# Rule for objects.
-$(OBJECTS): pnm.h $(DEFPPM) $(DEFPGM) $(DEFPBM)
+$(OBJECTS): $(DEFPNM) $(DEFPPM) $(DEFPGM) $(DEFPBM)
$(CC) $(ALLCFLAGS) "-Dmain=$*_main" -c $*.c
# And libraries.
@@ -153,15 +166,15 @@
ar rc $(LIBPNM) libpnm1.o libpnm2.o libpnm3.o libpnm4.o
-ranlib $(LIBPNM)
-libpnm1.o: pnm.h $(DEFPPM) $(DEFPGM) $(DEFPBM) libpnm1.c
+libpnm1.o: $(DEFPNM) $(DEFPPM) $(DEFPGM) $(DEFPBM) libpnm1.c
$(CC) $(ALLCFLAGS) -c libpnm1.c
-libpnm2.o: pnm.h $(DEFPPM) $(DEFPGM) $(DEFPBM) libpnm2.c $(DEFLIBPPM) \
+libpnm2.o: $(DEFPNM) $(DEFPPM) $(DEFPGM) $(DEFPBM) libpnm2.c $(DEFLIBPPM) \
$(DEFLIBPGM) $(DEFLIBPBM)
$(CC) $(ALLCFLAGS) -c libpnm2.c
-libpnm3.o: pnm.h $(DEFPPM) $(DEFPGM) $(DEFPBM) libpnm3.c $(DEFLIBPPM) \
+libpnm3.o: $(DEFPNM) $(DEFPPM) $(DEFPGM) $(DEFPBM) libpnm3.c $(DEFLIBPPM) \
$(DEFLIBPGM) $(DEFLIBPBM)
$(CC) $(ALLCFLAGS) -c libpnm3.c
-libpnm4.o: pnm.h $(DEFPPM) $(DEFPGM) $(DEFPBM) rast.h libpnm4.c
+libpnm4.o: $(DEFPNM) $(DEFPPM) $(DEFPGM) $(DEFPBM) rast.h libpnm4.c
$(CC) $(ALLCFLAGS) -c libpnm4.c
# Other dependencies.
@@ -202,6 +215,8 @@
tifftopnm tifftopnm.o: tifftopnm.c
xwdtopnm xwdtopnm.o: xwdtopnm.c x10wd.h x11wd.h
zeisstopnm zeisstopnm.o: zeisstopnm.c
+pnmhisteq pnmhisteq.o: pnmhisteq.c
+pnmsmooth pnmsmooth.o: pnmsmooth.c
clean:
- -rm -f *.o *.a *.cat *~ core $(BINARIES) pnmmerge
+ -rm -f *.o *.a *.cat *~ core *.core $(BINARIES) pnmmerge
|