1# SPDX-License-Identifier: GPL-2.0
2# Makefile for vm tools
3#
4VAR_CFLAGS := $(shell pkg-config --cflags libtracefs 2>/dev/null)
5VAR_LDLIBS := $(shell pkg-config --libs libtracefs 2>/dev/null)
6
7TARGETS = latency-collector
8CFLAGS = -Wall -Wextra -g -O2 $(VAR_CFLAGS)
9LDFLAGS = -lpthread $(VAR_LDLIBS)
10
11all: $(TARGETS)
12
13%: %.c
14	$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS)
15
16clean:
17	$(RM) latency-collector
18
19prefix ?= /usr/local
20sbindir ?= ${prefix}/sbin
21
22install: all
23	install -d $(DESTDIR)$(sbindir)
24	install -m 755 -p $(TARGETS) $(DESTDIR)$(sbindir)
25