Make tweaking CFLAGS/LDFLAGS porting infrastructure agnostic.

This commit is contained in:
Jasper Lievisse Adriaanse 2010-12-06 12:31:54 +13:00 committed by Daniel Beer
parent d8afaf3537
commit 837c020277
1 changed files with 13 additions and 9 deletions

View File

@ -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