summaryrefslogtreecommitdiff
path: root/ecp/src
diff options
context:
space:
mode:
Diffstat (limited to 'ecp/src')
-rw-r--r--ecp/src/Makefile23
-rw-r--r--ecp/src/common.mk9
-rw-r--r--ecp/src/htable/Makefile4
-rw-r--r--ecp/src/vconn/Makefile3
4 files changed, 24 insertions, 15 deletions
diff --git a/ecp/src/Makefile b/ecp/src/Makefile
index 120fcbc..5fed12a 100644
--- a/ecp/src/Makefile
+++ b/ecp/src/Makefile
@@ -1,10 +1,11 @@
-include platform.mk
-CFLAGS += -I.
+include common.mk
obj = core.o timer.o dir.o dir_srv.o
-subdirs = crypto ../platform/$(platform)
+subdirs = crypto $(platform_dir)
+build_dir = ../build-$(platform)
+
+include $(platform_dir)/platform_obj.mk
-include ../platform/$(platform)_obj.mk
%.o: %.c
$(CC) $(CFLAGS) -c $<
@@ -19,16 +20,16 @@ all: $(obj)
done
install: all
- mkdir -p build-$(platform)/
- install libecp.a build-$(platform)/
- install crypto/libecpcr.a build-$(platform)/
- install ../platform/$(platform)/libecptm.a build-$(platform)/
- install ../platform/$(platform)/libecptr.a build-$(platform)/
+ mkdir -p $(build_dir)
+ install libecp.a $(build_dir)
+ install crypto/libecpcr.a $(build_dir)
+ install $(platform_dir)/libecptm.a $(build_dir)
+ install $(platform_dir)/libecptr.a $(build_dir)
if [ -f htable/libecpht.a ]; then \
- install htable/libecpht.a build-$(platform)/; \
+ install htable/libecpht.a $(build_dir); \
fi
if [ -f vconn/libecpvconn.a ]; then \
- install vconn/libecpvconn.a build-$(platform)/; \
+ install vconn/libecpvconn.a $(build_dir); \
fi
clean:
diff --git a/ecp/src/common.mk b/ecp/src/common.mk
new file mode 100644
index 0000000..a2f8663
--- /dev/null
+++ b/ecp/src/common.mk
@@ -0,0 +1,9 @@
+platform ?= posix
+
+pwd := $(abspath $(dir $(firstword $(MAKEFILE_LIST))))
+ecp_dir := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))/..)
+src_dir := $(abspath $(ecp_dir)/src)
+platform_dir = $(abspath $(ecp_dir)/platform/$(platform))
+
+include $(platform_dir)/platform.mk
+CFLAGS += -I$(src_dir) -I$(platform_dir)
diff --git a/ecp/src/htable/Makefile b/ecp/src/htable/Makefile
index 76a4efd..854af5e 100644
--- a/ecp/src/htable/Makefile
+++ b/ecp/src/htable/Makefile
@@ -1,5 +1,5 @@
-include ../platform.mk
-CFLAGS += -I.. -std=gnu89
+include ../common.mk
+CFLAGS += -std=gnu89
obj = htable.o hashtable.o hashtable_itr.o
diff --git a/ecp/src/vconn/Makefile b/ecp/src/vconn/Makefile
index 459d16b..17962c4 100644
--- a/ecp/src/vconn/Makefile
+++ b/ecp/src/vconn/Makefile
@@ -1,5 +1,4 @@
-include ../platform.mk
-CFLAGS += -I..
+include ../common.mk
obj = vconn.o