summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlouie <lshprung@yahoo.com>2020-09-14 16:14:48 -0700
committerlouie <lshprung@yahoo.com>2020-09-14 16:14:48 -0700
commit47659f11b50cce9eea576f791273e814fdf6fc8d (patch)
treebbe7a86c75265af068effc26edae1f28923a9c50
parent260d18f1caf3922b045e9592274d738d46cf8a1a (diff)
Rewrote Makefile, added install and uninstall options
-rw-r--r--Makefile38
-rw-r--r--docs/README.md18
2 files changed, 49 insertions, 7 deletions
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
diff --git a/docs/README.md b/docs/README.md
index 86ce1fa..c284593 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -4,7 +4,7 @@
## Compiling and Running
-tml can be compiled on any system with gcc and the ncurses library installed. It has been tested to work on Ubuntu, and can also be compiled and run on Windows 10. To compile and run tml:
+tml can be compiled on any system with gcc and the ncurses library installed. It has been tested to work on Ubuntu, and can also be compiled and run on Windows 10, but is designed with Linux in mind. To compile and run tml:
1. Clone the repository
2. Run `make` in the directory the repository was cloned into. This will create a file called `tml`
@@ -12,6 +12,21 @@ tml can be compiled on any system with gcc and the ncurses library installed. It
Note that tml will not run until you have created a configuration file.
+### Installation
+
+tml can be installed by running:
+
+```
+sudo make install
+```
+
+This will install `tml` to `/usr/local/bin/tml` as well as man pages `tml` and `tml-config`.
+To uninstall these files:
+
+```
+sudo make uninstall
+```
+
## Configuration File
By default, tml searches in the following order for a configuration file:
@@ -27,3 +42,4 @@ tml -c /path/to/config
```
For Documentation of the configuration file, see [tml-config](tml-config.md)
+If you installed tml, you can also consult **tml**(1) and **tml-config**(5).