From: Huck Boles Date: Tue, 17 Jan 2023 17:28:27 +0000 (-0600) Subject: README and Makefile cleanup X-Git-Url: https://git.huck.website/?a=commitdiff_plain;h=d770fb96b402b39d593a1918f74ecb791ef47e59;p=odot.git README and Makefile cleanup --- diff --git a/Makefile b/Makefile index f7f0c52..de3db81 100644 --- a/Makefile +++ b/Makefile @@ -1,53 +1,57 @@ +PROG = odot +VERSION ?= 0.2.1 + SHELL = /bin/bash + DESTDIR ?= -PREFIX = $(DESTDIR)/usr -BINDIR = $(PREFIX)/bin -MANDIR = $(PREFIX)/share/man/man1 +PREFIX ?= $(DESTDIR)/usr +BINDIR ?= $(PREFIX)/bin +LIBDIR ?= $(PREFIX)/lib +MANDIR ?= $(PREFIX)/share/man/man1 -PROG = odot +FILES ?= $(wildcard *.c) +HEADERS ?= $(wildcard *.h) +OBJECTS ?= $(wildcard *.o) CC ?= gcc -CFILE = $(PROG).c database.c actions.c function.c -HEADER = $(PROG).h sqlite3.h -OBJECTS = $(PROG).o database.o actions.o function.o sqlite3.o -LDFLAGS += -L . -LDLIBS += -lpthread -CFLAGS += -O3 +CFLAGS += -O2 -std=c17 -pipe WARNINGS ?= -Werror -Wall -Wextra -Wpedantic -Wno-unused -CPPFLAGS += $(CPPFLAGX) -I . -ALL_CFLAGS = $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(LDLIBS) $(WARNINGS) +CPPFLAGS += -I . +LDFLAGS += -L . +LDLIBS += +ALL_FLAGS = $(CPPFLAGS) $(CFLAGS) $(WARNINGS) $(LDFLAGS) $(LDLIBS) -build: $(CFILE) $(HEADER) sqlite3.c - $(CC) $(CFILE) sqlite3.c $(ALL_CFLAGS) -o $(PROG) +.PHONY: all +all: $(FILES) $(HEADERS) + $(CC) $(FILES) $(ALL_FLAGS) -o $(PROG) -sql: sqlite3.c - $(CC) sqlite3.c $(ALL_CFLAGS) -c +.PHONY: install +install: $(PROG) $(PROG).1 + install -CDTm 755 $(PROG) $(BINDIR)/$(PROG) + [[ -e $(PROG).1 ]] && gzip -fc $(PROG).1 > $(MANDIR)/$(PROG).1.gz -header: $(HEADER) - $(CC) $(HEADER) $(ALL_CFLAGS) -c +.PHONY: tar +tar: $(FILES) $(HEADERS) $(PROG).1 Makefile README LICENSE + tar -g gzip -cf $(PROG)-$(VERSION).tar.gz $(FILES) $(HEADERS) $(PROG).1 Makefile README LICENSE -compile: $(CFILE) - $(CC) $(CFILE) $(ALL_CFLAGS) -c +.PHONY: compile +compile: $(FILES) + $(CC) $(FILES) $(ALL_FLAGS) -c +.PHONY: link link: $(OBJECTS) - $(CC) $(OBJECTS) $(ALL_CFLAGS) -o $(PROG) + $(CC) $(OBJECTS) $(ALL_FLAGS) -o $(PROG) -sqlbuild: $(CFILE) $(HEADER) sqlite3.o - $(CC) $(CFILE) sqlite3.o $(ALL_CFLAGS) -o $(PROG) +.PHONY: assemble +assemble: $(FILES) + $(CC) $(FILES) $(ALL_FLAGS) -S -install: $(CFILE) $(HEADER) sqlite3.c - $(CC) $(CFILE) sqlite3.c $(ALL_CFLAGS) -o $(PROG) - install -CDTm 755 $(PROG) $(BINDIR)/$(PROG) - gzip -cf $(PROG).1 > $(PROG).1.gz - install -CDTm 644 $(PROG).1.gz $(MANDIR)/$(PROG).1 - -debug: $(CFILE) $(HEADER) - $(CC) $(CFILE) sqlite3.o $(CFLAGS) -ggdb3 -Og -o $(PROG) +.PHONY: debug +debug: $(FILES) + $(CC) $(FILES) $(ALL_FLAGS) -ggdb3 -Og -o $(PROG) +.PHONY: clean clean: + [[ -f $(BINDIR)/$(PROG) ]] && rm $(BINDIR)/$(PROG) [[ -f $(PROG) ]] && rm $(PROG) - [[ -f $(DESTDIR)/$(PROG) ]] && sudo rm $(BINDIR)/$(PROG) - -dbclean: - rm *.db diff --git a/README b/README index df8098a..b65a357 100644 --- a/README +++ b/README @@ -3,32 +3,16 @@ odot v0.2.1 Task manager written in C Installation: + + Download source files + $ curl "https://download.huck.website/odot-[VERSION].tar.gz" > odot.tar.gz - - Arch Linux: Available in the AUR + Unpack source files + $ tar -xzvf odot.tar.gz + $ cd odot - - Manual: - - # Make and enter directory for odot - $ mkdir odot && cd odot - - # Download source files - $ curl "https://download.huck.website/odot-[VERSION].tar.gz" > odot-[VERSION].tar.gz - - # Optional: Download and check pgp signature - $ curl "https://download.huck.website/odot-[VERSION].tar.gz.sig" > odot-[VERSION].tar.gz.sig - $ curl "https://download.huck.website/pub.asc" > huck.asc - $ gpg --import huck.asc - $ gpg --verify odot-[VERSION].tar.gz.sig odot-[VERSION].tar.gz - - # Unpack source files - $ tar -xzvf odot-[VERSION].tar.gz - - # Build odot - Global install: - $ sudo make install - Local install: - $ make clean sql build - + Build odot + $ make && sudo make install Usage: @@ -53,16 +37,16 @@ Usage: Examples: Add a task to default group: - $ odot new task + $ odot new "task" Show tasks in default group: $ odot show Add a task to a group called newgroup: - $ odot new -g newgroup things to do + $ odot new -g newgroup "things to do" Finish a task and show other completed tasks: - $ odot done thing I did -d + $ odot done "thing I did" -d Show all completed tasks in a group called tasks: $ odot show -dg tasks @@ -71,5 +55,5 @@ Examples: $ odot show -da Remove a task from database (completely removes task from memory, useful for typos): - $ odot remove task I want to forget + $ odot remove "task I want to forget"