--- Makefile.orig	Mon Oct 28 16:43:34 2002
+++ Makefile	Tue Feb 17 08:20:39 2004
@@ -3,6 +3,7 @@
 #
 # usage:
 #   `make target=linux'             # linux
+#   `make target=freebsd'           # freebsd
 #   `make target=djggp2'            # dos32 - djggp2 2.03
 #   `make target=cygwin'            # win32 - cygwin 1.3.x
 #   `make target=mingw32'           # win32 - mingw32
@@ -221,6 +222,29 @@
 
 endif	# linux
 
+
+###
+### FreeBSD
+###
+
+ifeq ($(target),freebsd)
+override arch := $(shell uname -m | sed -e 's/^i[3456789]86$$/i386/')
+DEFS += '-DUPX_CONFIG_H="config_h/freebsd.h"'
+
+ifeq ($(DEBUG),1)
+  ##CFLAGS += -O0 -gstabs+3
+  ##CFLAGS += -O0 -gdwarf-2
+  CFLAGS += -O0 -g
+else
+  ##LDFLAGS += -static
+  STUBEDIT_EXE = objcopy -S -R .comment -R .note $@
+  ifeq ($(arch),i386)
+#    STUBIFY_EXE = perl $(srcdir)/stub/scripts/brandelf.pl $@
+    CHMOD_EXE = chmod 755 $@
+  endif
+endif
+
+endif	# freebsd
 
 ###
 ### Linux cross compilers
