From 193103a9816d1b5010745cd70892e64e71fc9448 Mon Sep 17 00:00:00 2001 From: Luna Date: Sat, 27 Apr 2019 02:41:23 -0300 Subject: [PATCH] makefile: add PREFIX and ensure_bin target - add build/install instructions --- Makefile | 12 +++++++++--- README.md | 15 ++++++++++++++- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index da359ad..2902d0a 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,12 @@ CFLAGS=-W -O LDFLAGS= LDLIBS= -all: journal +PREFIX=/usr/local + +all: ensure_bin journal + +ensure_bin: bin + mkdir -p bin install: journal mkdir -p $(DESTDIR)$(PREFIX)/bin @@ -16,9 +21,8 @@ install: journal uninstall: rm $(DESTDIR)$(PREFIX)/bin/journal -# builds for the journal only, other utils might come on later +# currently we only have one journal util, others may come later journal: src/journal/main.o - mkdir -p bin $(CC) $(LDFLAGS) -o bin/journal src/journal/main.o $(LDLIBS) src/journal/main.o: src/journal/main.c @@ -28,4 +32,6 @@ clean: .SUFFIXES: .c .o .c.o: + # $< mean the prereqs + # $@ means the target $(CC) $(CFLAGS) -c $< -o $@ diff --git a/README.md b/README.md index 84a10c2..56c90d6 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,16 @@ # lunabot -journal-like util for me \ No newline at end of file +journal-like util for me + +## building + + - a robot girl + - posix compliant make + - gcc/any cc + +``` +make + +# or just remove PREFIX for /usr/local +make PREFIX=$HOME/.local install +```