Every likes shared objects ... and I can use it from Rust

This commit is contained in:
Sebastian 2015-09-21 00:39:44 +02:00
parent 621741b046
commit 1df3dd1f44
2 changed files with 12 additions and 12 deletions

View File

@ -1,16 +1,13 @@
TARGET = twinkl-client
SRC = main.c twinklsocket.c
HEADERS = include/twinklsocket.h
HEADERS = include/twinklsocket.h
HEADERS += twinkl/include/twinkl.h twinkl/include/config.h twinkl/include/message.h
OBJDIR = bin
CC = clang
CFLAGS = -Wall -O2 -I include -I twinkl/include
LDFLAGS =
OBJ = $(SRC:%.c=$(OBJDIR)/%.o)
CFLAGS = -fPIC -Wall -O2 -I include -I twinkl/include
LDFLAGS =
all : start $(OBJDIR)/$(TARGET)
all : start $(OBJDIR)/twinkl-client
@echo ":: Done !"
start :
@ -25,7 +22,10 @@ $(OBJDIR)/%.o : %.c Makefile $(HEADERS)
mkdir -p $$(dirname $@)
$(CC) $(CFLAGS) -c $< -o $@
$(OBJDIR)/$(TARGET) : $(OBJ)
$(OBJDIR)/twinklsocket.so : $(OBJDIR)/twinklsocket.o
$(CC) $+ -shared $(LDFLAGS) -o $@
$(OBJDIR)/twinkl-client : $(OBJDIR)/main.o $(OBJDIR)/twinklsocket.so
$(CC) $+ $(LDFLAGS) -o $@
clean :

View File

@ -3,10 +3,10 @@
#include "message.h"
int twinklsocket_open(const char *host, const char *port);
extern int twinklsocket_open(const char *host, const char *port);
void twinklsocket_send(int sockfd, const struct twinkl_message *message);
extern void twinklsocket_send(int sockfd, const struct twinkl_message *message);
void twinklsocket_close(int sockfd);
extern void twinklsocket_close(int sockfd);
#endif