diff --git a/Makefile b/Makefile index bd8cd5e..ad5e435 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -CC ?= gcc +CC = gcc INSTALL = /usr/bin/install PREFIX ?= /usr/local LDFLAGS ?= -s @@ -29,14 +29,18 @@ else READLINE_LIBS = -lreadline endif -# Mac OS X/MacPorts stuff UNAME := $(shell sh -c 'uname -s') -ifeq ($(UNAME),Darwin) - MACPORTS_CFLAGS = -I/opt/local/include - MACPORTS_LDFLAGS = -L/opt/local/lib +ifeq ($(UNAME),Darwin) # Mac OS X/MacPorts stuff + PORTS_CFLAGS = -I/opt/local/include + PORTS_LDFLAGS = -L/opt/local/lib else - MACPORTS_CFLAGS = - MACPORTS_LDFLAGS = + ifeq ($(UNAME),OpenBSD) # OpenBSD Ports stuff + PORTS_CFLAGS = `pkg-config --cflags libelf libusb` + PORTS_LDFLAGS = `pkg-config --libs libelf libusb` + else + PORTS_CFLAGS = + PORTS_LDFLAGS = + endif endif MSPDEBUG_CFLAGS = -O1 -Wall -Wno-char-subscripts -ggdb @@ -60,7 +64,7 @@ mspdebug: main.o fet.o rf2500.o dis.o uif.o olimex.o ihex.o elf32.o stab.o \ reader.o vector.o output_util.o expr.o fet_error.o binfile.o \ fet_db.o usbutil.o titext.o srec.o device.o coff.o opdb.o output.o \ cmddb.o stdcmd.o prog.o flash_bsl.o - $(CC) $(LDFLAGS) $(MACPORTS_LDFLAGS) -o $@ $^ -lusb $(READLINE_LIBS) + $(CC) $(LDFLAGS) $(PORTS_LDFLAGS) -o $@ $^ -lusb $(READLINE_LIBS) .c.o: - $(CC) $(CFLAGS) $(MACPORTS_CFLAGS) $(READLINE_CFLAGS) $(MSPDEBUG_CFLAGS) -o $@ -c $*.c + $(CC) $(CFLAGS) $(PORTS_CFLAGS) $(READLINE_CFLAGS) $(MSPDEBUG_CFLAGS) -o $@ -c $*.c