makefile: add PREFIX and ensure_bin target

- add build/install instructions
This commit is contained in:
Luna 2019-04-27 02:41:23 -03:00
parent 309e919585
commit 193103a981
2 changed files with 23 additions and 4 deletions

View File

@ -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 $@

View File

@ -1,3 +1,16 @@
# lunabot
journal-like util for me
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
```