VERSION = 1.0

BINDIR=usr/bin
WARNFLAGS=-Wall -Wshadow -W -Wformat -Wimplicit-function-declaration -Wimplicit-int
CFLAGS+= -O1 ${WARNFLAGS} -fstack-protector
CC=$(CROSS_COMPILE)gcc

CFLAGS+=-D VERSION=\"$(VERSION)\"
LDFLAGS+=
TARGET=tmon

INSTALL_PROGRAM=install -m 755 -p
DEL_FILE=rm -f

# Static builds might require -ltinfo, for instance
ifneq ($(findstring -static, $(LDFLAGS)),)
STATIC := --static
endif

TMON_LIBS=-lm -lpthread
TMON_LIBS += $(shell pkg-config --libs $(STATIC) panelw ncursesw 2> /dev/null || \
		     pkg-config --libs $(STATIC) panel ncurses 2> /dev/null || \
		     echo -lpanel -lncurses)

CFLAGS    += $(shell pkg-config --cflags $(STATIC) panelw ncursesw 2> /dev/null || \
		     pkg-config --cflags $(STATIC) panel ncurses 2> /dev/null)

OBJS = tmon.o tui.o sysfs.o pid.o
OBJS +=

tmon: $(OBJS) Makefile tmon.h
	$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS)  -o $(TARGET) $(TMON_LIBS)

valgrind: tmon
	 sudo valgrind -v --track-origins=yes --tool=memcheck --leak-check=yes --show-reachable=yes --num-callers=20 --track-fds=yes ./$(TARGET)  1> /dev/null

install:
	- mkdir -p $(INSTALL_ROOT)/$(BINDIR)
	- $(INSTALL_PROGRAM) "$(TARGET)" "$(INSTALL_ROOT)/$(BINDIR)/$(TARGET)"

uninstall:
	$(DEL_FILE) "$(INSTALL_ROOT)/$(BINDIR)/$(TARGET)"

clean:
	find . -name "*.o" | xargs $(DEL_FILE)
	rm -f $(TARGET)

dist:
	git tag v$(VERSION)
	git archive --format=tar --prefix="$(TARGET)-$(VERSION)/" v$(VERSION) | \
		gzip > $(TARGET)-$(VERSION).tar.gz
 class='tabs'><tr><td>
<a href='/cgit.cgi/linux/net-next.git/?h=nds-private-remove'>summary</a><a href='/cgit.cgi/linux/net-next.git/refs/?h=nds-private-remove&amp;id=853277481178fdf14d1a4e9e6ac7174d6046176f'>refs</a><a class='active' href='/cgit.cgi/linux/net-next.git/log/net/ceph/crush?h=nds-private-remove'>log</a><a href='/cgit.cgi/linux/net-next.git/tree/net/ceph/crush?h=nds-private-remove&amp;id=853277481178fdf14d1a4e9e6ac7174d6046176f'>tree</a><a href='/cgit.cgi/linux/net-next.git/commit/net/ceph/crush?h=nds-private-remove&amp;id=853277481178fdf14d1a4e9e6ac7174d6046176f'>commit</a><a href='/cgit.cgi/linux/net-next.git/diff/net/ceph/crush?h=nds-private-remove&amp;id=853277481178fdf14d1a4e9e6ac7174d6046176f'>diff</a></td><td class='form'><form class='right' method='get' action='/cgit.cgi/linux/net-next.git/log/net/ceph/crush'>
<input type='hidden' name='h' value='nds-private-remove'/><input type='hidden' name='id' value='853277481178fdf14d1a4e9e6ac7174d6046176f'/><select name='qt'>
<option value='grep'>log msg</option>
<option value='author'>author</option>
<option value='committer'>committer</option>
<option value='range'>range</option>
</select>
<input class='txt' type='search' size='10' name='q' value=''/>
<input type='submit' value='search'/>
</form>
</td></tr></table>
<div class='path'>path: <a href='/cgit.cgi/linux/net-next.git/log/?h=nds-private-remove&amp;id=853277481178fdf14d1a4e9e6ac7174d6046176f'>root</a>/<a href='/cgit.cgi/linux/net-next.git/log/net?h=nds-private-remove&amp;id=853277481178fdf14d1a4e9e6ac7174d6046176f'>net</a>/<a href='/cgit.cgi/linux/net-next.git/log/net/ceph?h=nds-private-remove&amp;id=853277481178fdf14d1a4e9e6ac7174d6046176f'>ceph</a>/<a href='/cgit.cgi/linux/net-next.git/log/net/ceph/crush?h=nds-private-remove&amp;id=853277481178fdf14d1a4e9e6ac7174d6046176f'>crush</a></div><div class='content'><table class='list nowrap'><tr class='nohover'><th class='left'>Age</th><th class='left'>Commit message (<a href='/cgit.cgi/linux/net-next.git/log/net/ceph/crush?h=nds-private-remove&amp;id=853277481178fdf14d1a4e9e6ac7174d6046176f&amp;showmsg=1'>Expand</a>)</th><th class='left'>Author</th><th class='left'>Files</th><th class='left'>Lines</th></tr>