--- makefile.orig	Tue Aug 10 18:47:06 1993
+++ makefile	Tue Jun  4 13:56:54 2002
@@ -42,7 +42,7 @@
 
 PROJ	= hpack
 
-CFLAGS	= -c -D__UNIX__ -O -I. $(CMDC)	# Flags for compiler
+CFLAGS  += -c -D__UNIX__ -I. $(CMDC)  # Flags for compiler
 
 LFLAGS	= -o $(PROJ) -lcurses $(CMDL)	# Flags for linker
 
@@ -55,6 +55,7 @@
 ECHO	= echo				# Echo to screen command
 MAKE	= make				# The make command
 MV		= mv				# Rename command
+PREFIX  ?= /usr/local
 
 #****************************************************************************
 #*																			*
@@ -68,7 +69,7 @@
 		@$(ECHO)
 		@$(ECHO) "To create HPACK, you have to enter the Unix system type you want to build it"
 		@$(ECHO) "for.  Possible options are: aix (RS6000), aix370, aix386, bsd386, convex,"
-		@$(ECHO) "irix, hpux, hpux-gcc, isc, linux, mint, next, osf1, qnx, sun, svr4, ultrix,"
+		@$(ECHO) "freebsd, irix, hpux, hpux-gcc, isc, linux, mint, next, osf1, qnx, sun, svr4, ultrix,"
 		@$(ECHO) "ultrix_old (Ultrix 3.x or earlier), and uts4.  If none of the above fit,"
 		@$(ECHO) "try 'make generic', and send a copy of any changes necessary to the author,"
 		@$(ECHO) "pgut1@cs.aukuni.ac.nz"
@@ -317,6 +318,21 @@
 
 convex:
 		@$(MAKE) hpack CMDC="-DCONVEX" CC="cc"
+
+freebsd:
+		@make $(PROJ) LFLAGS="-o $(PROJ) -ltermcap"
+		cd keycvt; make freebsd
+
+freebsd.install:
+		-@mkdir -p ${PREFIX}/bin
+		-@mkdir -p ${PREFIX}/etc
+		-@mkdir -p ${PREFIX}/lib/hpack
+		-@mkdir -p ${PREFIX}/man/man1
+		$(BSD_INSTALL_PROGRAM) $(PROJ) $(PREFIX)/bin
+		$(BSD_INSTALL_DATA) language.dat $(PREFIX)/lib/hpack
+		$(BSD_INSTALL_DATA) docs/$(PROJ).1 $(PREFIX)/man/man1
+		-[ ! -f $(PREFIX)/etc/hpack.cfg ] && $(BSD_INSTALL_DATA) -m 644 docs/hpack.cfg $(PREFIX)/etc
+		cd keycvt; $(MAKE) freebsd.install
 
 # Generic: Generic BSD-ish system running gcc
 
