Makefile 1.04 KB
Newer Older
Arnaud Rebillout's avatar
Arnaud Rebillout committed
1 2 3 4
PRG      = irqtop
CFLAGS  += -Wall -Wextra -Wshadow -Werror -O3
#CFLAGS  += -DDEBUG
LDFLAGS +=
Arnaud Rebillout's avatar
Arnaud Rebillout committed
5

Arnaud Rebillout's avatar
Arnaud Rebillout committed
6 7
INSTDIR = $(DESTDIR)$(PREFIX)

Arnaud Rebillout's avatar
Arnaud Rebillout committed
8 9 10 11
SRC=$(wildcard *.c)
HDR=$(wildcard *.h)
OBJ=$(patsubst %.c,%.o,$(SRC))

Arnaud Rebillout's avatar
Arnaud Rebillout committed
12
# Use V=1 to show verbose commands
Arnaud Rebillout's avatar
Arnaud Rebillout committed
13 14 15 16 17 18 19 20 21 22 23
override P:=$(if $(V),@true,@echo)
override V:=$(if $(V),,@)

$(PRG): $(OBJ)
	$(P) "  LINK  $@"
	$(V) $(CC) -o $@ $^ $(LDFLAGS)

%.o: %.c $(HDR)
	$(P) "  CC    $@"
	$(V) $(CC) $(CFLAGS) -c -o $@ $<

24
.PHONY: install uninstall clean distclean
Arnaud Rebillout's avatar
Arnaud Rebillout committed
25 26
install:
	$(P) "  INSTALL"
Arnaud Rebillout's avatar
Arnaud Rebillout committed
27 28 29 30
	$(V) $(INSTALL) -v -d $(INSTDIR)/bin
	$(V) $(INSTALL) -v -m 0755 $(PRG) $(INSTDIR)/bin
	$(V) $(INSTALL) -v -d $(INSTDIR)/share/man/man1
	$(V) $(INSTALL) -v -m 0644 $(PRG).1 $(INSTDIR)/share/man/man1
Arnaud Rebillout's avatar
Arnaud Rebillout committed
31 32 33

uninstall:
	$(P) "  UNINSTALL"
Arnaud Rebillout's avatar
Arnaud Rebillout committed
34 35 36 37
	$(V) rm -v -f $(INSTDIR)/bin/$(PRG)
	$(V) rmdir --ignore-fail-on-non-empty $(INSTDIR)/bin/
	$(V) rm -v -f $(INSTDIR)/share/man/man1/$(PRG).1
	$(V) rmdir --ignore-fail-on-non-empty $(INSTDIR)/share/man/man1
Arnaud Rebillout's avatar
Arnaud Rebillout committed
38 39 40

clean:
	$(P) "  CLEAN"
41
	$(V) $(RM) -v -f $(PRG) $(OBJ)
Arnaud Rebillout's avatar
Arnaud Rebillout committed
42 43 44

distclean: clean
	$(P) "  DISTCLEAN"
45
	$(V) $(RM) -v -f *.o *~