mirror of
https://github.com/corundum/corundum.git
synced 2025-01-16 08:12:53 +08:00
utils/: Fix and enhance Makefile
Not only for typical cross-compilation build environments: - allow to use CC definition from build environment - ditto for PREFIX, packaging typically wants to use /usr - use CPPFLAGS for include paths and just append - let build environment decide about things like -Ox, append rest of flags to CFLAGS - use LDFLAGS, typically set by build environment Signed-off-by: Joachim Foerster <joachim.foerster@missinglinkelectronics.com>
This commit is contained in:
parent
b79487dbf3
commit
2390ac9a23
@ -1,15 +1,18 @@
|
||||
|
||||
PREFIX = /usr/local
|
||||
PREFIX ?= /usr/local
|
||||
BINDIR = $(DESTDIR)$(PREFIX)/bin
|
||||
|
||||
CC = gcc
|
||||
CFLAGS = -O3 -Wall -I../modules/mqnic
|
||||
CC ?= gcc
|
||||
CFLAGS ?= -O3
|
||||
|
||||
CFLAGS += -Wall
|
||||
CPPFLAGS += -I../modules/mqnic
|
||||
|
||||
BIN = mqnic-config mqnic-dump mqnic-fw mqnic-bmc perout
|
||||
|
||||
GENDEPFLAGS = -MD -MP -MF .$(@F).d
|
||||
|
||||
ALL_CFLAGS = $(CFLAGS) $(GENDEPFLAGS)
|
||||
ALL_CFLAGS = $(CFLAGS) $(CPPFLAGS) $(GENDEPFLAGS)
|
||||
|
||||
all: $(BIN)
|
||||
|
||||
@ -17,19 +20,19 @@ all: $(BIN)
|
||||
$(CC) $(ALL_CFLAGS) -c -o $@ $<
|
||||
|
||||
mqnic-config: mqnic-config.o mqnic.o timespec.o
|
||||
$(CC) $(ALL_CFLAGS) $^ -o $@
|
||||
$(CC) $(ALL_CFLAGS) $(LDFLAGS) $^ -o $@
|
||||
|
||||
mqnic-dump: mqnic-dump.o mqnic.o
|
||||
$(CC) $(ALL_CFLAGS) $^ -o $@
|
||||
$(CC) $(ALL_CFLAGS) $(LDFLAGS) $^ -o $@
|
||||
|
||||
mqnic-fw: mqnic-fw.o mqnic.o flash.o flash_spi.o flash_bpi.o fpga_id.o bitfile.o
|
||||
$(CC) $(ALL_CFLAGS) $^ -o $@
|
||||
$(CC) $(ALL_CFLAGS) $(LDFLAGS) $^ -o $@
|
||||
|
||||
mqnic-bmc: mqnic-bmc.o mqnic.o
|
||||
$(CC) $(ALL_CFLAGS) $^ -o $@
|
||||
$(CC) $(ALL_CFLAGS) $(LDFLAGS) $^ -o $@
|
||||
|
||||
perout: perout.o timespec.o
|
||||
$(CC) $(ALL_CFLAGS) $^ -o $@
|
||||
$(CC) $(ALL_CFLAGS) $(LDFLAGS) $^ -o $@
|
||||
|
||||
install:
|
||||
install -d $(BINDIR)
|
||||
|
Loading…
x
Reference in New Issue
Block a user