summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config.mk24
-rw-r--r--makefile3
-rw-r--r--src/build/makefile4
-rw-r--r--src/kernel/makefile7
-rw-r--r--src/lib/makefile7
-rw-r--r--src/libc++/makefile7
-rw-r--r--src/makefile8
-rw-r--r--src/sys/init/makefile7
-rw-r--r--src/sys/makefile6
-rw-r--r--src/sys/vfs/makefile7
-rw-r--r--src/usr/example/makefile11
-rw-r--r--src/usr/makefile4
12 files changed, 25 insertions, 70 deletions
diff --git a/config.mk b/config.mk
index 755fa77e8..e4f6ebcfb 100644
--- a/config.mk
+++ b/config.mk
@@ -1,3 +1,14 @@
+all: ALL
+
+ifdef MODULE
+OBJDIR = ${ROOTPATH}/obj/modules/${MODULE}
+IMGDIR = ${ROOTPATH}/img
+EXTRACOMMONFLAGS += -fPIC
+else
+OBJDIR = ${ROOTPATH}/obj/hbicore
+IMGDIR = ${ROOTPATH}/img
+endif
+
CUSTOM_LINKER = ${ROOTPATH}/src/build/linker/linker
TRACEPP = ${ROOTPATH}/src/build/trace/tracepp
@@ -15,6 +26,9 @@ LDMAPFLAGS = -Map $@.map
INCDIR = ${ROOTPATH}/src/include/
+OBJECTS = $(addprefix ${OBJDIR}/, ${OBJS})
+LIBRARIES = $(addprefix ${IMGDIR}/, ${LIBS})
+
${OBJDIR}/%.o : %.C
mkdir -p ${OBJDIR}
${CXX} -c ${CXXFLAGS} $< -o $@ -I ${INCDIR}
@@ -43,3 +57,13 @@ ${IMGDIR}/%.bin: ${IMGDIR}/%.elf $(wildcard ${IMGDIR}/*.so)
%.clean:
cd ${basename $@} && ${MAKE} clean
+
+ALL: ${SUBDIRS} ${OBJECTS} ${LIBRARIES}
+ifdef IMAGES
+ ${MAKE} ${IMAGES}
+endif
+
+clean: $(patsubst %.d,%.clean, ${SUBDIRS})
+ (rm -f ${OBJECTS} $(addsuffix .hash, ${OBJECTS}) ${LIBRARIES} \
+ ${IMAGES} $(addsuffix .map, ${IMAGES}) )
+
diff --git a/makefile b/makefile
index 3bda10c6c..dcb3848e7 100644
--- a/makefile
+++ b/makefile
@@ -1,6 +1,3 @@
SUBDIRS = src.d
-all: ${SUBDIRS}
-clean: $(patsubst %.d,%.clean, ${SUBDIRS})
-
include ./config.mk
diff --git a/src/build/makefile b/src/build/makefile
index 65042ad2b..8d4c7d750 100644
--- a/src/build/makefile
+++ b/src/build/makefile
@@ -2,8 +2,4 @@ ROOTPATH = ../..
SUBDIRS = linker.d
-all: ${SUBDIRS}
-
-clean: $(patsubst %.d,%.clean, ${SUBDIRS})
-
include ${ROOTPATH}/config.mk
diff --git a/src/kernel/makefile b/src/kernel/makefile
index 807fdd894..057552b9d 100644
--- a/src/kernel/makefile
+++ b/src/kernel/makefile
@@ -1,14 +1,7 @@
ROOTPATH = ../..
-OBJDIR = ${ROOTPATH}/obj/hbicore
OBJS = start.o kernel.o console.o pagemgr.o heapmgr.o taskmgr.o cpumgr.o
OBJS += syscall.o scheduler.o spinlock.o exception.o vmmmgr.o timemgr.o
-OBJECTS = $(addprefix ${OBJDIR}/, ${OBJS})
-
-all: ${OBJECTS}
-
-clean:
- (rm -f ${OBJECTS} $(addsuffix .hash, ${OBJECTS}) )
include ${ROOTPATH}/config.mk
diff --git a/src/lib/makefile b/src/lib/makefile
index a2deef3a7..ee750951a 100644
--- a/src/lib/makefile
+++ b/src/lib/makefile
@@ -1,14 +1,7 @@
ROOTPATH = ../..
-OBJDIR = ${ROOTPATH}/obj/hbicore
OBJS = string.o stdlib.o
OBJS += syscall_stub.o syscall_task.o syscall_mutex.o syscall_msg.o
OBJS += syscall_mmio.o syscall_time.o
-OBJECTS = $(addprefix ${OBJDIR}/, ${OBJS})
-
-all: ${OBJECTS}
-
-clean:
- (rm -f ${OBJECTS} $(addsuffix .hash, ${OBJECTS}))
include ${ROOTPATH}/config.mk
diff --git a/src/libc++/makefile b/src/libc++/makefile
index 41263326f..ca087b378 100644
--- a/src/libc++/makefile
+++ b/src/libc++/makefile
@@ -1,12 +1,5 @@
ROOTPATH = ../..
-OBJDIR = ${ROOTPATH}/obj/hbicore
OBJS = builtins.o
-OBJECTS = $(addprefix ${OBJDIR}/, ${OBJS})
-
-all: ${OBJECTS}
-
-clean:
- (rm -f ${OBJECTS} $(addsuffix .hash, ${OBJECTS}))
include ${ROOTPATH}/config.mk
diff --git a/src/makefile b/src/makefile
index 2fd17b6fe..ca4f797ae 100644
--- a/src/makefile
+++ b/src/makefile
@@ -1,15 +1,7 @@
ROOTPATH = ..
-IMGDIR = ${ROOTPATH}/img
-OBJDIR = ${ROOTPATH}/obj/hbicore
SUBDIRS = kernel.d lib.d libc++.d sys.d usr.d build.d
IMAGES += ${IMGDIR}/hbicore.elf
IMAGES += ${IMGDIR}/hbicore.bin
-all: ${SUBDIRS}
- ${MAKE} ${IMAGES}
-
-clean: $(patsubst %.d,%.clean, ${SUBDIRS})
- (rm -f ${IMAGES} $(addsuffix .map, ${IMAGES}) )
-
include ${ROOTPATH}/config.mk
diff --git a/src/sys/init/makefile b/src/sys/init/makefile
index 64c2c1af9..7716e0917 100644
--- a/src/sys/init/makefile
+++ b/src/sys/init/makefile
@@ -1,12 +1,5 @@
ROOTPATH = ../../..
-OBJDIR = ${ROOTPATH}/obj/hbicore
OBJS = init_main.o
-OBJECTS = $(addprefix ${OBJDIR}/, ${OBJS})
-
-all: ${OBJECTS}
-
-clean:
- (rm -f ${OBJECTS} $(addsuffix .hash, ${OBJECTS}) )
include ${ROOTPATH}/config.mk
diff --git a/src/sys/makefile b/src/sys/makefile
index 21909711a..b9e20839f 100644
--- a/src/sys/makefile
+++ b/src/sys/makefile
@@ -1,11 +1,5 @@
ROOTPATH = ../..
-IMGDIR = ${ROOTPATH}/img
-OBJDIR = ${ROOTPATH}/obj/hbicore
SUBDIRS = init.d vfs.d
-all: ${SUBDIRS}
-
-clean: $(patsubst %.d,%.clean, ${SUBDIRS})
-
include ${ROOTPATH}/config.mk
diff --git a/src/sys/vfs/makefile b/src/sys/vfs/makefile
index 05d3b8774..767b09204 100644
--- a/src/sys/vfs/makefile
+++ b/src/sys/vfs/makefile
@@ -1,12 +1,5 @@
ROOTPATH = ../../..
-OBJDIR = ${ROOTPATH}/obj/hbicore
OBJS = vfs_main.o
-OBJECTS = $(addprefix ${OBJDIR}/, ${OBJS})
-
-all: ${OBJECTS}
-
-clean:
- (rm -f ${OBJECTS} $(addsuffix .hash, ${OBJECTS}) )
include ${ROOTPATH}/config.mk
diff --git a/src/usr/example/makefile b/src/usr/example/makefile
index 73642a088..16df1e37d 100644
--- a/src/usr/example/makefile
+++ b/src/usr/example/makefile
@@ -1,16 +1,7 @@
ROOTPATH = ../../..
-OBJDIR = ${ROOTPATH}/obj/modules/example
-IMGDIR = ${ROOTPATH}/img
-EXTRACOMMONFLAGS = -fPIC
+MODULE = example
OBJS = example.o
-OBJECTS = $(addprefix ${OBJDIR}/, ${OBJS})
LIBS = libexample.so
-LIBRARIES = $(addprefix ${IMGDIR}/, ${LIBS})
-
-all: ${OBJECTS} ${LIBRARIES}
-
-clean:
- (rm -f ${OBJECTS} $(addsuffix .hash, ${OBJECTS}) ${LIBRARIES} )
include ${ROOTPATH}/config.mk
diff --git a/src/usr/makefile b/src/usr/makefile
index 13071f2ad..609815f94 100644
--- a/src/usr/makefile
+++ b/src/usr/makefile
@@ -2,8 +2,4 @@ ROOTPATH = ../..
SUBDIRS = example.d
-all: ${SUBDIRS}
-
-clean: $(patsubst %.d,%.clean, ${SUBDIRS})
-
include ${ROOTPATH}/config.mk
OpenPOWER on IntegriCloud