Compare commits

..

2 commits

Author SHA1 Message Date
193103a981 makefile: add PREFIX and ensure_bin target
- add build/install instructions
2019-04-27 02:41:23 -03:00
309e919585 initial commit, initial makefile 2019-04-27 02:37:22 -03:00
4 changed files with 67 additions and 1 deletions

1
.gitignore vendored
View file

@ -52,3 +52,4 @@ Module.symvers
Mkfile.old
dkms.conf
bin/

37
Makefile Normal file
View file

@ -0,0 +1,37 @@
.POSIX:
.SUFFIXES:
CC=cc
CFLAGS=-W -O
LDFLAGS=
LDLIBS=
PREFIX=/usr/local
all: ensure_bin journal
ensure_bin: bin
mkdir -p bin
install: journal
mkdir -p $(DESTDIR)$(PREFIX)/bin
cp -f bin/journal $(DESTDIR)$(PREFIX)/bin
uninstall:
rm $(DESTDIR)$(PREFIX)/bin/journal
# currently we only have one journal util, others may come later
journal: src/journal/main.o
$(CC) $(LDFLAGS) -o bin/journal src/journal/main.o $(LDLIBS)
src/journal/main.o: src/journal/main.c
clean:
rm bin/journal src/journal/*.o
.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
```

15
src/journal/main.c Normal file
View file

@ -0,0 +1,15 @@
#include <stdio.h>
int main(int argc, char** argv)
{
if(argc < 2)
{
printf("usage: %s topic message\n", argv[0]);
return 0;
}
char *topic = argv[1];
printf("%s\n", topic);
return 0;
}