diff options
Diffstat (limited to 'tools/rmtool/Makefile')
| -rw-r--r-- | tools/rmtool/Makefile | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tools/rmtool/Makefile b/tools/rmtool/Makefile new file mode 100644 index 0000000..a66b7de --- /dev/null +++ b/tools/rmtool/Makefile @@ -0,0 +1,35 @@ +# rmtool - read-only NVIDIA RM host oracle (Open-IOV). +# +# Builds src/*.c into ./rmtool and a reusable lib/librmapi.a that rmtop links +# against. No external SDK or library dependency. +CC ?= gcc +CFLAGS ?= -O2 -Wall -Wextra +CPPFLAGS += -Iinclude +PREFIX ?= /usr/local + +OBJS = src/main.o src/rm_api.o src/query.o src/output.o src/gpu.o \ + src/engine.o src/mem.o src/nv2080.o +LIBOBJS = src/rm_api.o src/query.o src/output.o +LIB = lib/librmapi.a + +all: rmtool $(LIB) + +rmtool: $(OBJS) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJS) + +$(LIB): $(LIBOBJS) + @mkdir -p lib + ar rcs $@ $(LIBOBJS) + +src/%.o: src/%.c include/rm_api.h include/rmtool.h + $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< + +install: rmtool + install -d $(DESTDIR)$(PREFIX)/bin + install -m 0755 rmtool $(DESTDIR)$(PREFIX)/bin/rmtool + +clean: + rm -f $(OBJS) rmtool $(LIB) + rmdir lib 2>/dev/null || true + +.PHONY: all install clean |
