we now generate a lib \o/

This commit is contained in:
overflowerror 2017-01-02 23:01:06 +01:00
parent 6378ec965e
commit 7603e2decc
3 changed files with 10 additions and 3 deletions

View file

@ -7,12 +7,13 @@
CC = gcc CC = gcc
DEFS = -D_XOPEN_SOURCE=500 -D_BSD_SOURCE DEFS = -D_XOPEN_SOURCE=500 -D_BSD_SOURCE
CFLAGS = -Wall -Wextra -g -std=c99 -pedantic -DENDEBUG $(DEFS) CFLAGS = -Wall -Wextra -g -std=c99 -pedantic -DENDEBUG $(DEFS) -fPIC
LDFLAGS = $(DEFS) LDFLAGS = $(DEFS)
LIBFLAGS = -shared $(DEFS)
.PHONY: all clean .PHONY: all clean
all: example all: example libserwer.so
%.o: %.c %.o: %.c
$(CC) $(CFLAGS) -c -o $@ $< $(CC) $(CFLAGS) -c -o $@ $<
@ -20,6 +21,9 @@ all: example
example: example.o serwer.o ws_linear.o ws_utils.o help.o example: example.o serwer.o ws_linear.o ws_utils.o help.o
$(CC) $(LDFLAGS) -o $@ $^ $(CC) $(LDFLAGS) -o $@ $^
libserwer.so: serwer.o ws_linear.o ws_utils.o help.o
$(CC) $(LIBFLAGS) -o $@ $^
example.o: example.c serwer.h help.h example.o: example.c serwer.h help.h
help.o: help.c help.h help.o: help.c help.h
serwer.o: serwer.c serwer.h ws_types.h ws_modes.h ws_utils.h help.h serwer.o: serwer.c serwer.h ws_types.h ws_modes.h ws_utils.h help.h
@ -27,4 +31,4 @@ ws_utils.o: ws_utils.c ws_utils.h ws_types.h
ws_linear.o: ws_linear.c ws_modes.h ws_types.h serwer.h ws_utils.h ws_linear.o: ws_linear.c ws_modes.h ws_types.h serwer.h ws_utils.h
clean: clean:
rm -f *.o example rm -f *.o example libserwer.so

View file

@ -3,6 +3,7 @@
#include <assert.h> #include <assert.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdbool.h>
method_t ws_method(const char* string) { method_t ws_method(const char* string) {
if (strcmp(string, "OPTIONS") == 0) if (strcmp(string, "OPTIONS") == 0)

View file

@ -3,6 +3,8 @@
#include "ws_types.h" #include "ws_types.h"
#include <stdbool.h>
method_t ws_method(const char*); method_t ws_method(const char*);
const char* ws_method_string(method_t); const char* ws_method_string(method_t);
const char* ws_code_reason(int); const char* ws_code_reason(int);