diff options
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | Makefile | 27 | ||||
-rw-r--r-- | examples/hello.c (renamed from src/main.c) | 16 |
3 files changed, 25 insertions, 20 deletions
@@ -1 +1,3 @@ bin/ +*.o +*.so @@ -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) diff --git a/src/main.c b/examples/hello.c index c2087e7..dfa7767 100644 --- a/src/main.c +++ b/examples/hello.c @@ -27,20 +27,12 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include <sys/socket.h> -#include <sys/ioctl.h> -#include <linux/if_packet.h> -#include <netinet/in.h> -#include <net/if.h> -#include <net/ethernet.h> +#include <string.h> #include <stdio.h> -#include <stdlib.h> -#include <stdbool.h> #include <unistd.h> -#include <string.h> -#include "if_ether.h" -#include "dgram.h" -#include "link.h" +#include <onet/if_ether.h> +#include <onet/dgram.h> +#include <onet/link.h> #define TEST_STR "Hello from o.1p!! Meow meow!" |