2023-06-26 11:44:57 -07:00
|
|
|
# SPDX-License-Identifier: BSD-2-Clause-Views
|
|
|
|
# Copyright (c) 2019-2023 The Regents of the University of California
|
2019-07-17 18:48:50 -07:00
|
|
|
|
2021-10-21 11:08:17 +02:00
|
|
|
PREFIX ?= /usr/local
|
2021-02-01 00:00:56 -08:00
|
|
|
BINDIR = $(DESTDIR)$(PREFIX)/bin
|
2019-07-17 18:48:50 -07:00
|
|
|
|
2021-10-21 11:08:17 +02:00
|
|
|
CC ?= gcc
|
|
|
|
CFLAGS ?= -O3
|
|
|
|
|
|
|
|
CFLAGS += -Wall
|
2022-04-19 01:45:01 -07:00
|
|
|
CPPFLAGS += -Ilib -Iinclude
|
|
|
|
LDFLAGS += -Llib/mqnic
|
|
|
|
LDLIBS += -lmqnic
|
|
|
|
|
|
|
|
LIBMQNIC = lib/mqnic/libmqnic.a
|
2019-07-17 18:48:50 -07:00
|
|
|
|
2022-03-03 22:46:18 -08:00
|
|
|
BIN = mqnic-config
|
|
|
|
BIN += mqnic-dump
|
|
|
|
BIN += mqnic-fw
|
|
|
|
BIN += mqnic-bmc
|
2022-07-29 12:02:50 -07:00
|
|
|
BIN += mqnic-xcvr
|
2022-03-03 22:46:18 -08:00
|
|
|
BIN += perout
|
2021-02-01 00:00:56 -08:00
|
|
|
|
|
|
|
GENDEPFLAGS = -MD -MP -MF .$(@F).d
|
|
|
|
|
2021-10-21 11:08:17 +02:00
|
|
|
ALL_CFLAGS = $(CFLAGS) $(CPPFLAGS) $(GENDEPFLAGS)
|
2019-07-17 18:48:50 -07:00
|
|
|
|
|
|
|
all: $(BIN)
|
|
|
|
|
2022-04-19 01:45:01 -07:00
|
|
|
FORCE:
|
|
|
|
|
|
|
|
$(LIBMQNIC): FORCE
|
|
|
|
$(MAKE) -C $(dir $@) $(notdir $@)
|
|
|
|
|
2021-02-01 00:00:56 -08:00
|
|
|
%.o: %.c
|
|
|
|
$(CC) $(ALL_CFLAGS) -c -o $@ $<
|
2019-07-19 15:46:56 -07:00
|
|
|
|
2022-04-19 01:45:01 -07:00
|
|
|
mqnic-config: mqnic-config.o timespec.o $(LIBMQNIC)
|
|
|
|
$(CC) $(ALL_CFLAGS) $(LDFLAGS) $^ -o $@ $(LDLIBS)
|
2019-11-21 17:08:40 -08:00
|
|
|
|
2022-04-19 01:45:01 -07:00
|
|
|
mqnic-dump: mqnic-dump.o $(LIBMQNIC)
|
|
|
|
$(CC) $(ALL_CFLAGS) $(LDFLAGS) $^ -o $@ $(LDLIBS)
|
2019-07-19 15:48:33 -07:00
|
|
|
|
2022-04-19 13:36:02 -07:00
|
|
|
mqnic-fw: mqnic-fw.o flash.o flash_spi.o flash_bpi.o bitfile.o $(LIBMQNIC)
|
2022-04-19 01:45:01 -07:00
|
|
|
$(CC) $(ALL_CFLAGS) $(LDFLAGS) $^ -o $@ $(LDLIBS)
|
2021-01-31 21:32:57 -08:00
|
|
|
|
2022-04-19 01:45:01 -07:00
|
|
|
mqnic-bmc: mqnic-bmc.o $(LIBMQNIC)
|
|
|
|
$(CC) $(ALL_CFLAGS) $(LDFLAGS) $^ -o $@ $(LDLIBS)
|
2021-02-01 00:00:56 -08:00
|
|
|
|
2022-07-29 12:02:50 -07:00
|
|
|
mqnic-xcvr: mqnic-xcvr.o $(LIBMQNIC) drp.o xcvr_gt.o xcvr_gthe3.o xcvr_gtye3.o xcvr_gthe4.o xcvr_gtye4.o
|
|
|
|
$(CC) $(ALL_CFLAGS) $(LDFLAGS) $^ -o $@ $(LDLIBS)
|
|
|
|
|
2021-02-01 00:00:56 -08:00
|
|
|
perout: perout.o timespec.o
|
2022-04-19 01:45:01 -07:00
|
|
|
$(CC) $(ALL_CFLAGS) $(LDFLAGS) $^ -o $@ $(LDLIBS)
|
2019-07-17 18:48:50 -07:00
|
|
|
|
|
|
|
install:
|
|
|
|
install -d $(BINDIR)
|
|
|
|
install -m 0755 $(BIN) $(BINDIR)
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -f $(BIN)
|
2021-02-01 00:00:56 -08:00
|
|
|
rm -f *.o
|
|
|
|
rm -f .*.d
|
2022-08-17 13:13:43 +02:00
|
|
|
$(MAKE) -C $(dir $(LIBMQNIC))/ $@
|
2021-02-01 00:00:56 -08:00
|
|
|
|
|
|
|
-include $(wildcard .*.d)
|
2019-07-17 18:48:50 -07:00
|
|
|
|
2022-04-19 01:45:01 -07:00
|
|
|
.PHONY: all install clean FORCE
|