diff --git a/Makefile b/Makefile
index f086750..2512343 100644
--- a/Makefile
+++ b/Makefile
@@ -5,10 +5,9 @@
 
 .DEFAULT_GOAL := default
 
-ODP_ROOT      = $(PWD)
-ODP_TESTS     = $(ODP_ROOT)/test
-PLATFORM_ROOT = $(ODP_ROOT)/platform/$(PLATFORM)
-INCLUDE       = -I$(ODP_ROOT)/include
+ODP_ROOT        = $(PWD)
+ODP_TESTS       = $(ODP_ROOT)/test
+export DESTDIR  = $(ODP_ROOT)/build
 
 include $(ODP_ROOT)/Makefile.inc
 
@@ -28,19 +27,19 @@ tests: libs_install
 
 .PHONY: docs
 docs:
-	$(MAKE) -C $(PLATFORM_ROOT) docs
+	$(MAKE) -C $(ODP_DIR) docs
 
 .PHONY: docs_install
 docs_install: docs
-	$(MAKE) -C $(PLATFORM_ROOT) docs_install
+	$(MAKE) -C $(ODP_DIR) docs_install
 
 .PHONY: lib
 lib:
-	$(MAKE) -C $(PLATFORM_ROOT) libs
+	$(MAKE) -C $(ODP_DIR) libs
 
 .PHONY: clean
 clean:
-	$(MAKE) -C $(PLATFORM_ROOT) clean
+	$(MAKE) -C $(ODP_DIR) clean
 	$(MAKE) -C $(ODP_TESTS) clean
 
 .PHONY: libs_install
diff --git a/Makefile.inc b/Makefile.inc
index 523385d..1af7643 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -4,27 +4,35 @@
 # SPDX-License-Identifier:	BSD-3-Clause
 
 PLATFORM ?= linux-generic
-CFLAGS  += -DODP_DEBUG=1
-CFLAGS  += -O3
-#CFLAGS  += -O0 -g
+OBJ_DIR   = ./obj
+ODP_DIR   = $(ODP_ROOT)/platform/$(PLATFORM)
 
-OBJ_DIR  = ./obj
-DESTDIR ?= $(ODP_ROOT)/build
-
-CFLAGS += -W -Wall -Werror -Wstrict-prototypes -Wmissing-prototypes
-CFLAGS += -Wmissing-declarations -Wold-style-definition -Wpointer-arith
-CFLAGS += -Wcast-align -Wnested-externs -Wcast-qual -Wformat-nonliteral
-CFLAGS += -Wformat-security -Wundef -Wwrite-strings
 
 CC     ?= gcc
 LD     ?= gcc
 AR     ?= ar
-
-ECHO   := echo
+ECHO   := @echo
 MKDIR  := mkdir -p
 RMDIR  := rm -rf
 RM     := rm -f
 COPY   := cp -r
 
-CFLAGS  += -pthread
+CFLAGS += -DODP_DEBUG=1
+CFLAGS += -O3
+#CFLAGS += -O0 -g
+CFLAGS += -pthread
+CFLAGS += -W -Wall -Werror -Wstrict-prototypes -Wmissing-prototypes
+CFLAGS += -Wmissing-declarations -Wold-style-definition -Wpointer-arith
+CFLAGS += -Wcast-align -Wnested-externs -Wcast-qual -Wformat-nonliteral
+CFLAGS += -Wformat-security -Wundef -Wwrite-strings
+
+
 LDFLAGS += -pthread
+LDFLAGS += -lrt
+LDFLAGS += $(EXTRA_CFLAGS)
+
+.PHONY: default
+default:
+
+$(OBJ_DIR):
+	$(MKDIR) $(OBJ_DIR)
diff --git a/platform/linux-generic/Makefile b/platform/linux-generic/Makefile
index b640928..676d4bf 100644
--- a/platform/linux-generic/Makefile
+++ b/platform/linux-generic/Makefile
@@ -78,8 +78,8 @@ all: libs docs
 
 -include $(DEPS)
 
-$(OBJ_DIR):
-	$(MKDIR) $(OBJ_DIR)
+#$(OBJ_DIR):
+#	$(MKDIR) $(OBJ_DIR)
 
 $(LIB_DIR):
 	$(MKDIR) $(LIB_DIR)
diff --git a/test/Makefile.inc b/test/Makefile.inc
index 72bbebd..1bb6a3c 100644
--- a/test/Makefile.inc
+++ b/test/Makefile.inc
@@ -3,10 +3,21 @@
 #
 # SPDX-License-Identifier:	BSD-3-Clause
 
-ODP_TEST_ROOT = $(ODP_ROOT)/test
 
+ifdef DESTDIR
+
+ODP_LIB = $(DESTDIR)/lib/libodp.a
 CFLAGS += -I$(DESTDIR)/include
-LIB = -L$(DESTDIR)/lib -lodp
+CFLAGS += -I$(DESTDIR)/include/api
+
+else
+
+ODP_LIB = $(ODP_DIR)/lib/libodp.a
+CFLAGS += -I$(ODP_ROOT)/include
+CFLAGS += -I$(ODP_DIR)/include/api
+
+$(ODP_LIB):
+	@echo Building $@
+	$(MAKE) -C $(ODP_DIR) libs
 
-LDFLAGS += -lrt
-LDFLAGS += $(EXTRA_CFLAGS)
+endif
diff --git a/test/api_test/Makefile b/test/api_test/Makefile
index 15c18f4..1c90174 100644
--- a/test/api_test/Makefile
+++ b/test/api_test/Makefile
@@ -12,12 +12,19 @@ ODP_ATOMIC    = odp_atomic
 ODP_SHM       = odp_shm
 ODP_RING      = odp_ring
 
-CFLAGS  += -I$(ODP_ROOT)/platform/linux-generic/include
-
-include ../Makefile.inc
 include $(ODP_ROOT)/Makefile.inc
+include ../Makefile.inc
+
+.PHONY: default
+default: all
+
+CFLAGS  += -I.
+#CFLAGS  += -I$(ODP_LIB)
+#CFLAGS  += -I$(ODP_ROOT)/platform/linux-generic/include
+#CFLAGS  += -I$(ARCH_INC)
+#CFLAGS  += -DODP_TEST_ATOMIC
+
 
-CFLAGS      += -I$(ODP_TEST_ROOT)/api_test
 
 ATOMIC_OBJS  =
 ATOMIC_OBJS += $(OBJ_DIR)/odp_common.o
@@ -41,12 +48,6 @@ ring: $(OBJ_DIR) $(ODP_RING)
 
 -include $(DEPS)
 
-$(DESTDIR)/lib/libodp.a:
-	@test -e $@ || (echo "$@ is missing" && false)
-
-$(OBJ_DIR): $(DESTDIR)/lib/libodp.a
-	$(MKDIR) $(OBJ_DIR)
-
 #
 # Compile rules
 #
@@ -57,17 +58,17 @@ $(OBJ_DIR)/%.o: %.c
 #
 # Link rule
 #
-$(ODP_ATOMIC): $(ATOMIC_OBJS)
+$(ODP_ATOMIC): $(ODP_LIB) $(ATOMIC_OBJS)
 	$(ECHO) Linking $<
-	$(CC) $(LDFLAGS) $(ATOMIC_OBJS) $(LIB) -o $@
+	$(CC) $(LDFLAGS) $(ATOMIC_OBJS) $(ODP_LIB) -o $@
 
-$(ODP_SHM): $(SHM_OBJS)
+$(ODP_SHM): $(ODP_LIB) $(SHM_OBJS)
 	$(ECHO) Linking $<
-	$(CC) $(LDFLAGS) $(SHM_OBJS) $(LIB) -o $@
+	$(CC) $(LDFLAGS) $(SHM_OBJS) $(ODP_LIB) -o $@
 
-$(ODP_RING): $(RING_OBJS)
+$(ODP_RING): $(ODP_LIB) $(RING_OBJS)
 	$(ECHO) Linking $<
-	$(CC) $(LDFLAGS) $(RING_OBJS) $(LIB) -o $@
+	$(CC) $(LDFLAGS) $(RING_OBJS) $(ODP_LIB) -o $@
 
 .PHONY: clean
 clean:
@@ -75,6 +76,7 @@ clean:
 	$(RM) $(ODP_ATOMIC)
 	$(RM) $(ODP_SHM)
 	$(RM) $(ODP_RING)
+	$(MAKE) -C $(ODP_DIR) clean
 
 .PHONY: install
 install:
diff --git a/test/example/Makefile b/test/example/Makefile
index d43e780..ba3940f 100644
--- a/test/example/Makefile
+++ b/test/example/Makefile
@@ -6,24 +6,22 @@
 ODP_ROOT = ../..
 ODP_APP  = odp_example
 
-include ../Makefile.inc
 include $(ODP_ROOT)/Makefile.inc
+include ../Makefile.inc
+
+.PHONY: default
+default: $(OBJ_DIR) $(ODP_APP)
+
+
+CFLAGS  += -I.
 
 OBJS     =
 OBJS    += $(OBJ_DIR)/odp_example.o
 
 DEPS     = $(OBJS:.o=.d)
 
-.PHONY: all
-all: $(OBJ_DIR) $(ODP_APP)
-
 -include $(DEPS)
 
-$(DESTDIR)/lib/libodp.a:
-	@test -e $@ || (echo "$@ is missing" && false)
-
-$(OBJ_DIR): $(DESTDIR)/lib/libodp.a
-	$(MKDIR) $(OBJ_DIR)
 
 #
 # Compile rules
@@ -35,14 +33,15 @@ $(OBJ_DIR)/%.o: %.c
 #
 # Link rule
 #
-$(ODP_APP): $(OBJS)
+$(ODP_APP): $(ODP_LIB) $(OBJS)
 	$(ECHO) Linking $<
-	$(CC) $(LDFLAGS) $(OBJS) $(LIB) -o $@
+	$(CC) $(LDFLAGS) $(OBJS) $(ODP_LIB) -o $@
 
 .PHONY: clean
 clean:
 	$(RMDIR) $(OBJ_DIR)
 	$(RM) $(ODP_APP)
+	$(MAKE) -C $(ODP_DIR) clean
 
 .PHONY: install
 install:
diff --git a/test/packet/Makefile b/test/packet/Makefile
index f1cb7d9..83c813b 100644
--- a/test/packet/Makefile
+++ b/test/packet/Makefile
@@ -6,27 +6,21 @@
 ODP_ROOT = ../..
 ODP_APP  = odp_packet
 
-include ../Makefile.inc
-include $(ODP_ROOT)/Makefile.inc
+CFLAGS  += -I.
 
-CFLAGS  += -I$(ODP_TEST_ROOT)/packet
+include $(ODP_ROOT)/Makefile.inc
+include ../Makefile.inc
 
 OBJS     =
 OBJS    += $(OBJ_DIR)/odp_example_pktio.o
 
 DEPS     = $(OBJS:.o=.d)
 
-.PHONY: all
-all: $(OBJ_DIR) $(ODP_APP)
+.PHONY: default
+default: $(OBJ_DIR) $(ODP_APP)
 
 -include $(DEPS)
 
-$(DESTDIR)/lib/libodp.a:
-	@test -e $@ || (echo "$@ is missing" && false)
-
-$(OBJ_DIR): $(DESTDIR)/lib/libodp.a
-	$(MKDIR) $(OBJ_DIR)
-
 #
 # Compile rules
 #
@@ -37,14 +31,14 @@ $(OBJ_DIR)/%.o: %.c
 #
 # Link rule
 #
-$(ODP_APP): $(OBJS)
-	$(ECHO) Linking $<
-	$(CC) $(LDFLAGS) $(OBJS) $(LIB) -o $@
+$(ODP_APP): $(ODP_LIB) $(OBJS)
+	$(CC) $(LDFLAGS) $(OBJS) $(ODP_LIB) -o $@
 
 .PHONY: clean
 clean:
 	$(RMDIR) $(OBJ_DIR)
 	$(RM) $(ODP_APP)
+	$(MAKE) -C $(ODP_DIR) clean
 
 .PHONY: install
 install:
diff --git a/test/packet_netmap/Makefile b/test/packet_netmap/Makefile
index 5febb33..1ef0df1 100644
--- a/test/packet_netmap/Makefile
+++ b/test/packet_netmap/Makefile
@@ -6,28 +6,22 @@
 ODP_ROOT = ../..
 ODP_APP  = odp_packet
 
+CFLAGS  += -I.
 CFLAGS  += -DODP_HAVE_NETMAP
-CFLAGS  += -O0 -g
 
-include ../Makefile.inc
 include $(ODP_ROOT)/Makefile.inc
+include ../Makefile.inc
 
 OBJS     =
 OBJS    += $(OBJ_DIR)/odp_example_pktio_netmap.o
 
 DEPS     = $(OBJS:.o=.d)
 
-.PHONY: all
-all: $(OBJ_DIR) $(ODP_APP)
+.PHONY: default
+default: $(OBJ_DIR) $(ODP_APP)
 
 -include $(DEPS)
 
-$(DESTDIR)/lib/libodp.a:
-	@test -e $@ || (echo "$@ is missing" && false)
-
-$(OBJ_DIR): $(DESTDIR)/lib/libodp.a
-	$(MKDIR) $(OBJ_DIR)
-
 #
 # Compile rules
 #
@@ -38,14 +32,14 @@ $(OBJ_DIR)/%.o: %.c
 #
 # Link rule
 #
-$(ODP_APP): $(OBJS)
-	$(ECHO) Linking $<
-	$(CC) $(LDFLAGS) $(OBJS) $(LIB) -o $@
+$(ODP_APP): $(ODP_LIB) $(OBJS)
+	$(CC) $(LDFLAGS) $(OBJS) $(ODP_LIB) -o $@
 
 .PHONY: clean
 clean:
 	$(RMDIR) $(OBJ_DIR)
 	$(RM) $(ODP_APP)
+	$(MAKE) -C $(ODP_DIR) clean
 
 .PHONY: install
 install:
