aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjvech <jmvalenciae@unal.edu.co>2023-10-21 11:08:50 -0500
committerjvech <jmvalenciae@unal.edu.co>2023-10-21 11:08:50 -0500
commit8abcac7b3b42609f349b8a9cb132bae9746ba576 (patch)
tree89751a747d873576e3ecb60e21483747ea211967
parent5e7240fbe867e1dd3008e737995cda45d63c5083 (diff)
setup: Install and uninstall rules added
The man page must have a section specifying where to save configurations files for loading the network architecture and weights.
-rw-r--r--Makefile14
-rw-r--r--config.mk4
-rw-r--r--doc/ml.19
-rw-r--r--src/util.c6
4 files changed, 32 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 457dc62..856e3b4 100644
--- a/Makefile
+++ b/Makefile
@@ -1,3 +1,5 @@
+include config.mk
+
CC = clang
CFLAGS = -std=gnu11 -Wall -g
BIN = ml
@@ -21,6 +23,18 @@ $(OBJDIR)/%.o: src/%.c $(HEADERS)
build: $(OBJS)
${CC} ${DLIBS} -o ${BIN} ${OBJS}
+install: all
+ @# binary
+ install -d $(BINPREFIX)
+ install -m 755 ${BIN} $(BINPREFIX)/${BIN}
+ @#man page
+ install -d $(MANPREFIX)/man1
+ install -m 644 doc/ml.1 $(MANPREFIX)/man1/ml.1
+
+uninstall:
+ rm -v $(BINPREFIX)/${BIN}
+ rm -v $(MANPREFIX)/man1/ml.1
+
run: build
@./${BIN} train data/sample_data.json | tee data/train_history.txt
@./${BIN} predict data/sample_data.json | jq -r '.[] | [values[] as $$val | $$val] | @tsv' > data/net_data.tsv
diff --git a/config.mk b/config.mk
new file mode 100644
index 0000000..b9350ff
--- /dev/null
+++ b/config.mk
@@ -0,0 +1,4 @@
+PREFIX ?= /usr/local
+
+BINPREFIX := $(PREFIX)/bin
+MANPREFIX := $(PREFIX)/share/man
diff --git a/doc/ml.1 b/doc/ml.1
index 4329e80..dee805c 100644
--- a/doc/ml.1
+++ b/doc/ml.1
@@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3.
-.TH ML "1" "September 2023" "ml 0.1" "User Commands"
+.TH ML "1" "October 2023" "ml 0.1" "User Commands"
.SH NAME
ml \- manual page for ml 0.1
.SH SYNOPSIS
@@ -30,3 +30,10 @@ Output file (only works with predict)
\f(CW$ ml predict housing.json -o predictions.json\fR
.SH AUTHOR
Written by vech
+.SH COPYRIGHT
+Copyright \(co 2023 jvech
+.PP
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
diff --git a/src/util.c b/src/util.c
index 3fb61f2..8c7ec14 100644
--- a/src/util.c
+++ b/src/util.c
@@ -77,6 +77,12 @@ char *e_strdup(const char *s)
void version()
{
printf("ml 0.1\n");
+ printf( "Copyright (C) 2023 jvech\n\n"
+ "This program is free software: you can redistribute it and/or modify\n"
+ "it under the terms of the GNU General Public License as published by\n"
+ "the Free Software Foundation, either version 3 of the License, or\n"
+ "(at your option) any later version.\n\n"
+ );
printf("Written by vech\n");
exit(0);
}
Feel free to download, copy and edit any repo