diff options
| author | Nakidai <nakidai@disroot.org> | 2024-11-24 17:28:03 +0300 |
|---|---|---|
| committer | Nakidai <nakidai@disroot.org> | 2024-11-24 17:28:03 +0300 |
| commit | ebedf7a6c7487e9845ae36d55e6b5c461a243d0c (patch) | |
| tree | ab647bfd76a486918164a3e292361abf601db323 | |
| parent | 366e82eda8ca21af78334e046eefa2846542aa63 (diff) | |
| download | libhttpc-ebedf7a6c7487e9845ae36d55e6b5c461a243d0c.tar.gz libhttpc-ebedf7a6c7487e9845ae36d55e6b5c461a243d0c.zip | |
Add install & uninstall recipies
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | Makefile | 12 | ||||
| -rwxr-xr-x | configure | 36 |
3 files changed, 49 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore index 89aff01..8bba76a 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ compile_commands.json obj/ .cache/ +config.mk diff --git a/Makefile b/Makefile index 0da4d45..86265ce 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,5 @@ +include config.mk + OBJS += obj/header.o OBJS += obj/libhttpc.o OBJS += obj/malloc.o @@ -24,5 +26,15 @@ libhttpc.so: libhttpc.a: ar rcs $@ $^ +install: all + install -d $(DESTDIR)/lib + install -m644 libhttpc.a $(DESTDIR)/lib + install -m755 libhttpc.so $(DESTDIR)/lib + install -m644 include/libhttpc.h $(DESTDIR)/include + +uninstall: + $(RM) $(DESTDIR)/lib/libhttpc.{a,so} + $(RM) $(DESTDIR)/include/libhttpc.h + clean: rm -f ${OBJS} libhttpc.a libhttpc.so diff --git a/configure b/configure new file mode 100755 index 0000000..fab6a12 --- /dev/null +++ b/configure @@ -0,0 +1,36 @@ +#!/bin/sh + +usage() +{ + echo "Use environment variables to pass values: + CC - compiler (default: cc) + CFLAGS - flags for compiler + LDFLAGS - flags for linker + DESTDIR - path to make install (default: /usr/local)" + exit 1 +} + +while test $# -gt 0; do + case "$1" in + -h) usage + ;; + --help) usage + ;; + esac + shift +done + +CC=${CC:-cc} +CFLAGS=${CFLAGS:-} +LDFLAGS=${LDFLAGS:-} +DESTDIR=${DESTDIR:-/usr/local} + +echo "Configuration: + Compiler: $CC + CFLAGS: $CFLAGS + LDFLAGS: $LDFLAGS + DESTDIR: $DESTDIR" + +echo " +DESTDIR=$DESTDIR +" > config.mk |