From 47659f11b50cce9eea576f791273e814fdf6fc8d Mon Sep 17 00:00:00 2001 From: louie Date: Mon, 14 Sep 2020 16:14:48 -0700 Subject: Rewrote Makefile, added install and uninstall options --- Makefile | 38 ++++++++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 6 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 91b5d34..3ce8010 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,35 @@ -CC = gcc -PROGS = tml +CC = gcc +NAME = tml +LIBS = -lncurses +PREFIX = /usr/local -all: $(PROGS) +$(NAME): draw.o read_cfg.o group.o entry.o + $(CC) -o $(NAME) draw.o read_cfg.o group.o entry.o $(LIBS) -clean:; $(RM) $(PROGS) *.o core +draw.o: draw.c read_cfg.h group.h entry.h +read_cfg.o: read_cfg.c group.o entry.o +group.o: group.c group.h entry.h +entry.o: entry.c entry.h read_cfg.h group.h -tml: draw.o read_cfg.o entry.o group.o - $(CC) -o tml draw.o read_cfg.o entry.o group.o -lncurses +.PHONY: clean +clean: + rm *.o $(NAME) + +ifneq ($(OS),Windows_NT) + +.PHONY: install +install: + mkdir -p $(DESTDIR)$(PREFIX)/bin + cp -i $(NAME) $(DESTDIR)$(PREFIX)/bin/$(NAME) + mkdir -p $(DESTDIR)$(PREFIX)/share/man/man1 + cp -i docs/$(NAME).1.gz $(DESTDIR)$(PREFIX)/share/man/man1/$(NAME).1.gz + mkdir -p $(DESTDIR)$(PREFIX)/share/man/man5 + cp -i docs/$(NAME)-config.5.gz $(DESTDIR)$(PREFIX)/share/man/man5/$(NAME)-config.5.gz + +.PHONY: install +uninstall: + rm -f $(DESTDIR)$(PREFIX)/bin/$(NAME) + rm -f $(DESTDIR)$(PREFIX)/share/man/man1/$(NAME).1.gz + rm -f $(DESTDIR)$(PREFIX)/share/man/man5/$(NAME)-config.5.gz + +endif -- cgit