Skip to content
Snippets Groups Projects
Commit 704714a6 authored by Anders Blomdell's avatar Anders Blomdell
Browse files

Preparing for use of dynamic library (currently disabled

by referring to liblabcomm.a in liblabcomm.so).
parent 000ca2a8
Branches
Tags
No related merge requests found
## Macros ## Macros
# Use LLVM clang if it's found. CC=gcc
CC = $(shell hash clang 2>/dev/null && echo clang || echo gcc)
CFLAGS=-g -Wall -Werror -O3 -I. -Itest -DLABCOMM_ENCODER_LINEAR_SEARCH CFLAGS=-g -Wall -Werror -O3 -I. -Itest -DLABCOMM_ENCODER_LINEAR_SEARCH
LDFLAGS=-L. LDFLAGS=-L.
LDLIBS_TEST = -Tlabcomm.linkscript -lcunit -llabcomm #LDLIBS_TEST=-Tlabcomm.linkscript -lcunit -llabcomm
LDLIBS_TEST=-lcunit -llabcomm
OBJS= labcomm.o \
labcomm_dynamic_buffer_writer.o labcomm_fd_reader.o labcomm_fd_writer.o \
labcomm_pthread_mutex_lock.o
OBJS= labcomm.o labcomm_dynamic_buffer_writer.o labcomm_fd_reader.o labcomm_fd_writer.o
#FIXME: labcomm_mem_reader.o labcomm_mem_writer.o #FIXME: labcomm_mem_reader.o labcomm_mem_writer.o
LABCOMM_JAR=../../compiler/labComm.jar LABCOMM_JAR=../../compiler/labComm.jar
LABCOMM=java -jar $(LABCOMM_JAR) LABCOMM=java -jar $(LABCOMM_JAR)
...@@ -35,11 +38,13 @@ endif ...@@ -35,11 +38,13 @@ endif
.PHONY: all run-test clean distclean .PHONY: all run-test clean distclean
all: liblabcomm.a all: liblabcomm.a liblabcomm.so.1
liblabcomm.a: $(OBJS) liblabcomm.a: $(OBJS)
ar -r liblabcomm.a $^ ar -r liblabcomm.a $^
liblabcomm.so.1: $(OBJS:%.o=%.pic.o)
gcc -shared -Wl,-soname,$@ -o $@ $^ -lc
labcomm.o : labcomm.c labcomm.h labcomm_private.h labcomm.o : labcomm.c labcomm.h labcomm_private.h
...@@ -85,6 +90,9 @@ $(LABCOMM_JAR): ...@@ -85,6 +90,9 @@ $(LABCOMM_JAR):
cd $(shell dirname $(LABCOMM_JAR)); ant jar cd $(shell dirname $(LABCOMM_JAR)); ant jar
@echo "======End building LabComm compiler======" @echo "======End building LabComm compiler======"
%.pic.o: %.c
$(CC) -fPIC $(CFLAGS) -c -o $@ $<
%.o: %.c %.h %.o: %.c %.h
clean: clean:
...@@ -98,6 +106,7 @@ clean: ...@@ -98,6 +106,7 @@ clean:
$(RM) $(TEST_DIR)/test_labcomm $(RM) $(TEST_DIR)/test_labcomm
distclean: clean distclean: clean
$(RM) liblabcomm.so.1
$(RM) liblabcomm.a $(RM) liblabcomm.a
# Extra dependencies # Extra dependencies
......
...@@ -44,6 +44,12 @@ ...@@ -44,6 +44,12 @@
#define LABCOMM_DECLARE_SIGNATURE(name) \ #define LABCOMM_DECLARE_SIGNATURE(name) \
struct labcomm_signature name __attribute__((section("labcomm"))) struct labcomm_signature name __attribute__((section("labcomm")))
/*
* Semi private lock declarations
*/
struct labcomm_lock {
};
/* /*
* Semi private decoder declarations * Semi private decoder declarations
*/ */
......
/*INPUT(liblabcomm.so.1 -ltinfo)*/
INPUT(liblabcomm.a)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment