1
0
mirror of https://github.com/corundum/corundum.git synced 2025-01-16 08:12:53 +08:00
corundum/utils/Makefile

69 lines
1.4 KiB
Makefile
Raw Permalink Normal View History

# 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
PREFIX ?= /usr/local
2021-02-01 00:00:56 -08:00
BINDIR = $(DESTDIR)$(PREFIX)/bin
2019-07-17 18:48:50 -07:00
CC ?= gcc
CFLAGS ?= -O3
CFLAGS += -Wall
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
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
ALL_CFLAGS = $(CFLAGS) $(CPPFLAGS) $(GENDEPFLAGS)
2019-07-17 18:48:50 -07:00
all: $(BIN)
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
mqnic-config: mqnic-config.o timespec.o $(LIBMQNIC)
$(CC) $(ALL_CFLAGS) $(LDFLAGS) $^ -o $@ $(LDLIBS)
2019-11-21 17:08:40 -08:00
mqnic-dump: mqnic-dump.o $(LIBMQNIC)
$(CC) $(ALL_CFLAGS) $(LDFLAGS) $^ -o $@ $(LDLIBS)
2019-07-19 15:48:33 -07:00
mqnic-fw: mqnic-fw.o flash.o flash_spi.o flash_bpi.o bitfile.o $(LIBMQNIC)
$(CC) $(ALL_CFLAGS) $(LDFLAGS) $^ -o $@ $(LDLIBS)
2021-01-31 21:32:57 -08:00
mqnic-bmc: mqnic-bmc.o $(LIBMQNIC)
$(CC) $(ALL_CFLAGS) $(LDFLAGS) $^ -o $@ $(LDLIBS)
2021-02-01 00:00:56 -08: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
$(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
$(MAKE) -C $(dir $(LIBMQNIC))/ $@
2021-02-01 00:00:56 -08:00
-include $(wildcard .*.d)
2019-07-17 18:48:50 -07:00
.PHONY: all install clean FORCE