Skip to content

Commit 9ac96a6

Browse files
Merge pull request #1 from teythoon/feature-cleanups
Feature cleanups
2 parents 62820c5 + 65db5c5 commit 9ac96a6

File tree

9 files changed

+44
-58
lines changed

9 files changed

+44
-58
lines changed

Makefile

Lines changed: 33 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -2,60 +2,49 @@
22
# Verona, August 2007 -- Massimo Del Fedele
33
# Adapted from Samsung ML-85P driver by Rildo Pragana
44

5-
CC=gcc
6-
CFLAGS=-O2 -s -Wall
7-
RELEASE=0.1.2
5+
CFLAGS ?= -O3 -Wall
86

9-
all: lbp800 parcapt
7+
TARGETS=lbp800 parcapt
108

11-
lbp800: \
9+
HEADERS=\
1210
machine.h \
13-
errcapt.c errcapt.h \
14-
bmcapt.c bmcapt.h \
15-
lbp800.c lbp800.h \
16-
Makefile
17-
${CC} ${INCLUDE} ${CFLAGS} \
18-
errcapt.c bmcapt.c lbp800.c \
19-
-l cups -o bin/Release/lbp800
20-
21-
parcapt: \
22-
machine.h \
23-
errcapt.c errcapt.h \
24-
pport.c pport.h \
25-
timcapt.c timcapt.h \
26-
llcapt.c llcapt.h \
27-
pkcapt.c pkcapt.h \
28-
hlcapt.c hlcapt.h \
29-
parcapt.h \
30-
parcapt.c \
31-
Makefile
32-
${CC} ${INCLUDE} ${CFLAGS} \
33-
errcapt.c pport.c timcapt.c llcapt.c pkcapt.c hlcapt.c parcapt.c \
34-
-l cups -o bin/Release/parcapt
11+
errcapt.h \
12+
bmcapt.h \
13+
lbp800.h \
14+
pport.h \
15+
timcapt.h \
16+
llcapt.h \
17+
pkcapt.h \
18+
hlcapt.h \
19+
parcapt.h \
20+
21+
22+
.PHONY: all
23+
all: $(TARGETS)
24+
25+
lbp800: errcapt.o bmcapt.o lbp800.o
26+
27+
parcapt: errcapt.o pport.o timcapt.o llcapt.o pkcapt.o hlcapt.o parcapt.o
3528

29+
%.o: %.c $(HEADERS)
30+
$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
3631

32+
.PHONY: install
3733
install: all
38-
install -s -m a=rx bin/Release/lbp800 /usr/bin
34+
install -m a=rx lbp800 /usr/bin
3935
install -m a=rx lbp800-print /usr/bin
4036
install -m a=r ppd/Canon-LBP-800.ppd /usr/share/ppd/custom
4137
install -m a=rx foo2lbp800-wrapper /usr/bin
42-
install -m a=rx bin/Release/parcapt /usr/lib/cups/backend
38+
install -m a=rx parcapt /usr/lib/cups/backend
4339

40+
.PHONY: uninstall
4441
uninstall:
45-
rm -f /usr/bin/lbp800
46-
rm -f /usr/bin/lbp800-print
47-
rm -f /usr/share/ppd/custom/Canon-LBP-800.ppd
48-
rm -f /usr/bin/foo2lbp800-wrapper
49-
rm -f /usr/lib/cups/backend/parcapt
42+
rm -f -- /usr/bin/lbp800
43+
rm -f -- /usr/bin/lbp800-print
44+
rm -f -- /usr/share/ppd/custom/Canon-LBP-800.ppd
45+
rm -f -- /usr/bin/foo2lbp800-wrapper
46+
rm -f -- /usr/lib/cups/backend/parcapt
5047

48+
.PHONY: clean
5149
clean:
52-
rm -f obj/Debug/*
53-
rm -f obj/Release/*
54-
rm -f bin/Release/lbp800 bin/Release/parcapt
55-
rm -f bin/Debug/lbp800 bin/Debug/parcapt
56-
57-
package: clean
58-
rm -f *~ ppd/*~
59-
cp -a ../lbp800 ../lbp800-${RELEASE}
60-
tar cvfz ../lbp800-${RELEASE}.tar.gz ../lbp800-${RELEASE}
61-
rm -rf ../lbp800-${RELEASE}
50+
rm -f -- $(TARGETS) *.o

bin/Debug/.gitkeep

Whitespace-only changes.

bin/Release/.gitkeep

Whitespace-only changes.

foo2lbp800-wrapper

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,6 @@
1818
#*
1919
#* Authors: Massimo Del Fedele <max@veneto.com>
2020

21-
echo "CMDLINE : $@\n\n" > /tmp/pippo-filter-1.txt
22-
#cat > /tmp/pippo-filter-2.txt
23-
#return 0;
24-
#gs -q -dNOPAUSE -dPARANOIDSAFER -dBATCH -r600x600 -sPAPERSIZE=a4 -sDEVICE=pbmraw -sOutputFile=- -
25-
# 1> /tmp/capt.log 2>&1
26-
gs -q -dNOPAUSE -dPARANOIDSAFER -dBATCH -r600x600 -sDEVICE=pbmraw -sOutputFile="|lbp800 -t 110 -l 110" -
27-
# 1> /tmp/capt.log 2>&1
28-
29-
30-
return 0;
21+
gs -q -dNOPAUSE -dPARANOIDSAFER -dBATCH -r600x600 -sDEVICE=pbmraw \
22+
-sOutputFile=- - \
23+
| lbp800 -t 110 -l 110

lbp800.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
// PROGRAMMA PRINCIPALE
3838
int main(int argc, char** argv)
3939
{
40-
char c;
40+
int c;
4141
fprintf(stderr,"lbp800:main is here\n");
4242
// BITMAP SORGENTE
4343
TSourceBitmap Bitmap;
@@ -76,6 +76,10 @@ int main(int argc, char** argv)
7676
}
7777
break;
7878

79+
default:
80+
fprintf(stderr, "Usage: %s [-t topskip] [-l leftskip] [-f file]\n",
81+
argv[0]);
82+
exit(EXIT_FAILURE);
7983
} // END switch()
8084
} // END while
8185

logs/.gitkeep

Whitespace-only changes.

obj/Debug/.gitkeep

Whitespace-only changes.

obj/Release/.gitkeep

Whitespace-only changes.

pport.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ inline int Parport_Open(char *DeviceName)
4949
Device = open (DeviceName, O_RDWR);
5050
// Device = open (DeviceName, O_RDWR|O_EXCL);
5151
if(Device == -1){
52-
fprintf(stderr, "DEBUG - pport:Parport_Open Can not open %s \n",DeviceName);
52+
fprintf(stderr, "ERROR: Parport_Open Can not open %s\n", DeviceName);
5353
return Device;
5454
}
5555
// sleep(2);
@@ -66,13 +66,13 @@ inline int Parport_Open(char *DeviceName)
6666

6767
if (ioctl (Device, PPCLAIM))
6868
{
69-
fprintf(stderr, "DEBUG - pport:Parport_Open Can not claim\n");
69+
perror("ERROR: Parport_Open Can not claim");
7070
close (Device);
7171
return -1;
7272
}
7373

7474
ioctl (Device, PPGETMODE, &bCurrentPortMode);
75-
fprintf(stderr, "DEBUG - pport:Parport_Open PPGETMODE %04Xh\n",(int)bCurrentPortMode);
75+
fprintf(stderr, "ERROR: Parport_Open PPGETMODE %04Xh\n", (int) bCurrentPortMode);
7676

7777
return Device;
7878

0 commit comments

Comments
 (0)