mirror of
https://github.com/corundum/corundum.git
synced 2025-01-16 08:12:53 +08:00
Peel off common software components into a static library
Signed-off-by: Alex Forencich <alex@alexforencich.com>
This commit is contained in:
parent
030281b7fc
commit
a1cd110074
40
lib/mqnic/Makefile
Normal file
40
lib/mqnic/Makefile
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
|
||||||
|
PREFIX ?= /usr/local
|
||||||
|
INCDIR = $(DESTDIR)$(PREFIX)/include
|
||||||
|
LIBDIR = $(DESTDIR)$(PREFIX)/lib
|
||||||
|
DEVLIBDIR = $(LIBDIR)
|
||||||
|
|
||||||
|
CC ?= gcc
|
||||||
|
CFLAGS ?= -O3 -fPIC
|
||||||
|
|
||||||
|
CFLAGS += -Wall
|
||||||
|
CPPFLAGS +=
|
||||||
|
|
||||||
|
LIB = libmqnic.a
|
||||||
|
INCLUDES = mqnic.h mqnic_hw.h mqnic_ioctl.h reg_block.h
|
||||||
|
|
||||||
|
GENDEPFLAGS = -MD -MP -MF .$(@F).d
|
||||||
|
|
||||||
|
ALL_CFLAGS = $(CFLAGS) $(CPPFLAGS) $(GENDEPFLAGS)
|
||||||
|
|
||||||
|
all: $(LIB)
|
||||||
|
|
||||||
|
%.o: %.c
|
||||||
|
$(CC) $(ALL_CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
|
libmqnic.a: mqnic.o reg_block.o
|
||||||
|
ar rcs $@ $^
|
||||||
|
|
||||||
|
install:
|
||||||
|
install -d $(DEVLIBDIR) $(INCDIR)/mqnic
|
||||||
|
install -m 0644 $(LIB) $(DEVLIBDIR)
|
||||||
|
install -m 0644 $(INCLUDES) $(INCDIR)/mqnic
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f $(LIB)
|
||||||
|
rm -f *.o
|
||||||
|
rm -f .*.d
|
||||||
|
|
||||||
|
-include $(wildcard .*.d)
|
||||||
|
|
||||||
|
.PHONY: all install clean
|
@ -32,6 +32,7 @@ either expressed or implied, of The Regents of the University of California.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "mqnic.h"
|
#include "mqnic.h"
|
||||||
|
#include "mqnic_ioctl.h"
|
||||||
|
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
@ -39,7 +39,6 @@ either expressed or implied, of The Regents of the University of California.
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "mqnic_hw.h"
|
#include "mqnic_hw.h"
|
||||||
#include "mqnic_ioctl.h"
|
|
||||||
#include "reg_block.h"
|
#include "reg_block.h"
|
||||||
|
|
||||||
#define mqnic_reg_read32(base, reg) (((volatile uint32_t *)(base))[(reg)/4])
|
#define mqnic_reg_read32(base, reg) (((volatile uint32_t *)(base))[(reg)/4])
|
1
lib/mqnic/mqnic_hw.h
Symbolic link
1
lib/mqnic/mqnic_hw.h
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../../modules/mqnic/mqnic_hw.h
|
1
lib/mqnic/mqnic_ioctl.h
Symbolic link
1
lib/mqnic/mqnic_ioctl.h
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../../modules/mqnic/mqnic_ioctl.h
|
@ -6,7 +6,11 @@ CC ?= gcc
|
|||||||
CFLAGS ?= -O3
|
CFLAGS ?= -O3
|
||||||
|
|
||||||
CFLAGS += -Wall
|
CFLAGS += -Wall
|
||||||
CPPFLAGS += -I../modules/mqnic -I ../include
|
CPPFLAGS += -Ilib -Iinclude
|
||||||
|
LDFLAGS += -Llib/mqnic
|
||||||
|
LDLIBS += -lmqnic
|
||||||
|
|
||||||
|
LIBMQNIC = lib/mqnic/libmqnic.a
|
||||||
|
|
||||||
BIN = mqnic-config
|
BIN = mqnic-config
|
||||||
BIN += mqnic-dump
|
BIN += mqnic-dump
|
||||||
@ -20,23 +24,28 @@ ALL_CFLAGS = $(CFLAGS) $(CPPFLAGS) $(GENDEPFLAGS)
|
|||||||
|
|
||||||
all: $(BIN)
|
all: $(BIN)
|
||||||
|
|
||||||
|
FORCE:
|
||||||
|
|
||||||
|
$(LIBMQNIC): FORCE
|
||||||
|
$(MAKE) -C $(dir $@) $(notdir $@)
|
||||||
|
|
||||||
%.o: %.c
|
%.o: %.c
|
||||||
$(CC) $(ALL_CFLAGS) -c -o $@ $<
|
$(CC) $(ALL_CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
mqnic-config: mqnic-config.o mqnic.o reg_block.o timespec.o
|
mqnic-config: mqnic-config.o timespec.o $(LIBMQNIC)
|
||||||
$(CC) $(ALL_CFLAGS) $(LDFLAGS) $^ -o $@
|
$(CC) $(ALL_CFLAGS) $(LDFLAGS) $^ -o $@ $(LDLIBS)
|
||||||
|
|
||||||
mqnic-dump: mqnic-dump.o mqnic.o reg_block.o
|
mqnic-dump: mqnic-dump.o $(LIBMQNIC)
|
||||||
$(CC) $(ALL_CFLAGS) $(LDFLAGS) $^ -o $@
|
$(CC) $(ALL_CFLAGS) $(LDFLAGS) $^ -o $@ $(LDLIBS)
|
||||||
|
|
||||||
mqnic-fw: mqnic-fw.o mqnic.o reg_block.o flash.o flash_spi.o flash_bpi.o fpga_id.o bitfile.o
|
mqnic-fw: mqnic-fw.o flash.o flash_spi.o flash_bpi.o fpga_id.o bitfile.o $(LIBMQNIC)
|
||||||
$(CC) $(ALL_CFLAGS) $(LDFLAGS) $^ -o $@
|
$(CC) $(ALL_CFLAGS) $(LDFLAGS) $^ -o $@ $(LDLIBS)
|
||||||
|
|
||||||
mqnic-bmc: mqnic-bmc.o mqnic.o reg_block.o
|
mqnic-bmc: mqnic-bmc.o $(LIBMQNIC)
|
||||||
$(CC) $(ALL_CFLAGS) $(LDFLAGS) $^ -o $@
|
$(CC) $(ALL_CFLAGS) $(LDFLAGS) $^ -o $@ $(LDLIBS)
|
||||||
|
|
||||||
perout: perout.o timespec.o
|
perout: perout.o timespec.o
|
||||||
$(CC) $(ALL_CFLAGS) $(LDFLAGS) $^ -o $@
|
$(CC) $(ALL_CFLAGS) $(LDFLAGS) $^ -o $@ $(LDLIBS)
|
||||||
|
|
||||||
install:
|
install:
|
||||||
install -d $(BINDIR)
|
install -d $(BINDIR)
|
||||||
@ -49,4 +58,4 @@ clean:
|
|||||||
|
|
||||||
-include $(wildcard .*.d)
|
-include $(wildcard .*.d)
|
||||||
|
|
||||||
.PHONY: all install clean
|
.PHONY: all install clean FORCE
|
||||||
|
1
utils/include
Symbolic link
1
utils/include
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../include/
|
@ -35,7 +35,7 @@ either expressed or implied, of The Regents of the University of California.
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "mqnic.h"
|
#include <mqnic/mqnic.h>
|
||||||
|
|
||||||
static void usage(char *name)
|
static void usage(char *name)
|
||||||
{
|
{
|
||||||
|
@ -50,7 +50,7 @@ either expressed or implied, of The Regents of the University of California.
|
|||||||
|
|
||||||
#include "timespec.h"
|
#include "timespec.h"
|
||||||
|
|
||||||
#include "mqnic.h"
|
#include <mqnic/mqnic.h>
|
||||||
|
|
||||||
#define NSEC_PER_SEC 1000000000
|
#define NSEC_PER_SEC 1000000000
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ either expressed or implied, of The Regents of the University of California.
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "mqnic.h"
|
#include <mqnic/mqnic.h>
|
||||||
|
|
||||||
static void usage(char *name)
|
static void usage(char *name)
|
||||||
{
|
{
|
||||||
|
@ -42,7 +42,7 @@ either expressed or implied, of The Regents of the University of California.
|
|||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <linux/pci.h>
|
#include <linux/pci.h>
|
||||||
|
|
||||||
#include "mqnic.h"
|
#include <mqnic/mqnic.h>
|
||||||
#include "bitfile.h"
|
#include "bitfile.h"
|
||||||
#include "flash.h"
|
#include "flash.h"
|
||||||
#include "fpga_id.h"
|
#include "fpga_id.h"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user