summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2025-09-25 16:21:41 -0400
committerIan Moffett <ian@osmora.org>2025-09-25 16:21:41 -0400
commit0e25563b4aaad1aea65535b5936e2cad9cc9fd88 (patch)
tree0f0be9225fabdd3b242ef2852a865914b16885b5 /Makefile
parentdb666b02a12666951ca7d1a099903beee0bb22f1 (diff)
build: Generate shared library API for o.1p
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile27
1 files changed, 19 insertions, 8 deletions
diff --git a/Makefile b/Makefile
index e949046..bb7b2c8 100644
--- a/Makefile
+++ b/Makefile
@@ -1,12 +1,23 @@
CFILES = $(shell find src/ -name "*.c")
-CFLAGS = -Isrc/include/ -pedantic
-OUTPUT = bin/otrx
+OBJ = $(CFILES:.c=.o)
+CFLAGS = -Isrc/include/ -pedantic -fPIC
+OUTPUT = libonet.so
CC = gcc
-.PHONY: all
-all: bin
- $(CC) $(CFILES) $(CFLAGS) -o $(OUTPUT)
+$(OUTPUT): $(OBJ)
+ $(CC) -shared -o $@ $(OBJ)
-.PHONY: bin
-bin:
- mkdir -p $@
+%.o: %.c
+ $(CC) -c $(CFLAGS) $< -o $@
+
+.PHONY: install
+install:
+ mkdir -p /usr/include/onet/
+ cp -r src/include/* /usr/include/onet/
+ cp libonet.so /usr/lib/
+ chmod 0755 /usr/lib/libonet.so
+ ldconfig
+
+.PHONY: clean
+clean:
+ rm -f $(OBJ)