summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2023-09-16 18:28:27 -0300
committerEuAndreh <eu@euandre.org>2025-03-20 15:58:40 -0300
commit3ff640a80d49cc9be137943ffd0da3fc60b8042d (patch)
tree322ed89356848232e8508cc8865074012b9d20d3 /Makefile
parentRemove support files (diff)
downloadagahu-3ff640a80d49cc9be137943ffd0da3fc60b8042d.tar.gz
agahu-3ff640a80d49cc9be137943ffd0da3fc60b8042d.tar.xz
Add complete "Makefile" for standard packaging
Also include a ".gitignore" with the derived assets. --- On the "Makefile", the canonical virtual targets implemented are: - "all": the default target name when no explicit name is given, or when one wants to build more than one target at once, such as: `make all check`. All it builds is the "libtweetnacl.a" library; - "check": NOOP, as there are no tests implemented; - "clean": removes the "tweetnacl.o" and "libtweetnacl.a" files, which represent 100% of the generated assets; - "install": uses `$(DESTDIR)`, `$(LIBDIR)`, `$(INCLUDEDIR)` and `$(SRCDIR)` to properly place the "libtweetnacl.a" library, the "tweetnacl.h" header and the "tweetnacl.c" source in the correct place. `$(LIBDIR)`, `$(INCLUDEDIR)` and `$(SRCDIR)` are defined based on `$(PREFIX)`; - "uninstall": a perfect mirror of "install", which removes 100% of the installed artifacts.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile35
1 files changed, 35 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..6b66dcd
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,35 @@
+.POSIX:
+PREFIX = /usr
+NAME = tweetnacl
+LIBDIR = $(PREFIX)/lib
+INCLUDEDIR = $(PREFIX)/include
+SRCDIR = $(PREFIX)/src/$(NAME)
+
+
+all: lib$(NAME).a
+
+lib$(NAME).a: lib$(NAME).a($(NAME).o)
+
+$(NAME).o: $(NAME).h
+
+
+check:
+
+clean:
+ rm -f *.o *.a
+
+
+install: all
+ mkdir -p \
+ '$(DESTDIR)$(LIBDIR)' \
+ '$(DESTDIR)$(INCLUDEDIR)' \
+ '$(DESTDIR)$(SRCDIR)'
+ cp lib$(NAME).a '$(DESTDIR)$(LIBDIR)'
+ cp $(NAME).h '$(DESTDIR)$(INCLUDEDIR)'
+ cp $(NAME).h $(NAME).c '$(DESTDIR)$(SRCDIR)'
+
+uninstall:
+ rm -rf \
+ '$(DESTDIR)$(LIBDIR)'/lib$(NAME).a \
+ '$(DESTDIR)$(INCLUDEDIR)'/$(NAME).h \
+ '$(DESTDIR)$(SRCDIR)'