--- cwebx-3.04.orig/Makefile
+++ cwebx-3.04/Makefile
@@ -10,20 +10,22 @@
 
 # We let CWEAVE report syntax errors by setting +d.
 # The flag +m makes the TeX output slightly more compact.
-# We use the +e flag since our printer is two-sided.
 
-CWFLAGS = +mde
+CWFLAGS = +md
 CTFLAGS =
 
 # We keep debugging info around to enable the `+d' option of cweave
-CFLAGS = -DDEBUG -DSTAT -g
-
-# RM and CP are used below in case rm and cp are aliased
-
-RM= /bin/rm
-CP= /bin/cp
-RENAME= /bin/mv
-
+CFLAGS = -DDEBUG -DSTAT -g -Wall
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+CFLAGS += -O0
+else
+CFLAGS += -O2
+endif
+
+# This is handled by debhelper's dh_strip
+# ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
+# INSTALL_PROGRAM += -s
+# endif
 
 # Set CCHANGES to common-foo.ch if you need changes to common.w in another
 # file than common.ch
@@ -69,32 +71,33 @@
 manual doc: manual.dvi
 listings: common.dvi ctangle.dvi cweave.dvi
 
-cautiously:
+cautiously: ctangle
 	make common.c ctangle.c cweave.c
-	$(RENAME) ctangle SAVEctangle # save version in case things mess up
+	mv ctangle SAVEctangle # save version in case things mess up
 	make ctangle
-	$(RENAME) common.c SAVEcommon.c
+	mv common.c SAVEcommon.c
 	./ctangle common $(CCHANGES)
 	diff common.c SAVEcommon.c
-	$(RENAME) SAVEcommon.c common.c # restore date
-	$(RENAME) ctangle.c SAVEctangle.c
+	mv SAVEcommon.c common.c # restore date
+	mv ctangle.c SAVEctangle.c
 	./ctangle ctangle $(TCHANGES)
 	diff ctangle.c SAVEctangle.c
-	$(RENAME) SAVEctangle.c ctangle.c # restore date
-	$(RENAME) cweave.c SAVEcweave.c
+	mv SAVEctangle.c ctangle.c # restore date
+	mv cweave.c SAVEcweave.c
 	./ctangle cweave $(WCHANGES)
 	diff cweave.c SAVEcweave.c
-	$(RENAME) SAVEcweave.c cweave.c # restore date
-	$(RM) SAVEctangle # succeeded, use new binary from now on
+	mv SAVEcweave.c cweave.c # restore date
+	rm SAVEctangle # succeeded, use new binary from now on
 
 SAVEctangle.c:
-	$(CP) ctangle.c SAVEctangle.c
+	cp ctangle.c SAVEctangle.c
 
 SAVEcommon.c:
-	$(CP) common.c SAVEcommon.c
+	cp common.c SAVEcommon.c
 
 common.c: common.w $(CCHANGES) common.inc
 	$(CTANGLE) common $(CCHANGES)
+
 common.h: common.w $(CCHANGES)
 	$(CTANGLE) common $(CCHANGES)
 
@@ -120,3 +123,21 @@
 	$(CWEAVE) cweave $(WCHANGES)
 
 manual.dvi: compare.tex
+
+# Debian additions: we need a clean and install target of course!!
+
+# Are we going to suffix an `x' on the end of filenames to distinguish
+# CWEBx from K&L CWEB?
+DESTPREF=x
+
+INSTALLROOT=debian/cwebx
+BINDIR=$(INSTALLROOT)/usr/bin
+MACRODIR=$(INSTALLROOT)/usr/share/texmf/tex/plain/litprog
+
+clean:
+	-rm -f *.dvi *.log *.o ctangle cweave cweave.c manual.toc
+
+install:
+	cp cweave $(BINDIR)/cweave$(DESTPREF)
+	cp ctangle $(BINDIR)/ctangle$(DESTPREF)
+	cp cweb?mac.tex $(MACRODIR)
