Enable build info rebuild upon HEAD commit ID change
[akaros.git] / kern / src / Kbuild
index d2a9d18..f4cb602 100644 (file)
@@ -7,15 +7,47 @@ $(src)/error.c: $(AKAROS_ROOT)/include/ros/errno.h
        @echo "};"                             >> $(@)
        @echo "const int MAX_ERRNO = sizeof(errno_strings)/sizeof(errno_strings[0]);" >> $(@)
 
+$(src)/build_info.cid:
+       @echo `git rev-parse HEAD` > $(src)/build_info.cid.tmp
+       @if [ ! -f $(src)/build_info.cid ] || \
+               [ `cmp -s $(src)/build_info.cid $(src)/build_info.cid.tmp` -ne 0 ]; then \
+                       cp $(src)/build_info.cid.tmp $(src)/build_info.cid; fi;
+       @rm -f $(src)/build_info.cid.tmp
+
+$(src)/build_info.c: $(src)/build_info.cid
+ifeq ($(BUILD_INFO_FILE),)
+               @echo "/* Automatically generated. DO NOT EDIT! */" > $(@)
+               @echo "" >> $(@)
+               @echo "const char build_info_kernel_path[] = { \"$(KERNEL_ELF_PATH)\" };"\
+                       >> $(@)
+               @echo "const char build_info_date[] = { \"`date`\" };"\
+                       >> $(@)
+               @echo "const char build_info_host[] = { \"`hostname`\" };"\
+                       >> $(@)
+               @echo "const char build_info_commitid[] = { \"`cat $(src)/build_info.cid`\" };"\
+                       >> $(@)
+               @echo "const char build_info_version[] = { \"$(KERNELVERSION)\" };"\
+                       >> $(@)
+               @echo "const char build_info_version_name[] = { \"$(VERNAME)\" };"\
+                       >> $(@)
+else
+               cp $(BUILD_INFO_FILE) $(@)
+endif
+
+clean-files += build_info.c build_info.cid error.c
+
 obj-y                                          += alarm.o
 obj-y                                          += apipe.o
 obj-y                                          += arsc.o
 obj-y                                          += atomic.o
 obj-y                                          += bitmap.o
 obj-y                                          += blockdev.o
+obj-y                                          += build_info.o
 obj-y                                          += ceq.o
 obj-y                                          += colored_caches.o
+obj-y                                          += completion.o
 obj-y                                          += console.o
+obj-y                                          += coreprov.o
 obj-y                                          += ctype.o
 obj-y                                          += devfs.o
 obj-y                                          += dmapool.o
@@ -28,6 +60,7 @@ obj-y                                         += event.o
 obj-y                                          += ext2fs.o
 obj-y                                          += ex_table.o
 obj-y                                          += fdtap.o
+obj-$(CONFIG_COREALLOC_FCFS) += corealloc_fcfs.o
 obj-y                                          += find_next_bit.o
 obj-y                                          += find_last_bit.o
 obj-y                                          += frontend.o
@@ -37,6 +70,7 @@ obj-y                                         += init.o
 obj-y                                          += kdebug.o
 obj-y                                          += kfs.o
 obj-y                                          += kmalloc.o
+obj-y                                          += kreallocarray.o
 obj-y                                          += ktest/
 obj-y                                          += kthread.o
 obj-y                                          += manager.o
@@ -45,9 +79,10 @@ obj-y                                                += monitor.o
 obj-y                                          += multiboot.o
 obj-y                                          += net/
 obj-y                                          += ns/
-obj-y                                          += oprofile/
+obj-y                                          += profiler.o
 obj-y                                          += page_alloc.o
 obj-y                                          += pagemap.o
+obj-y                                          += percpu.o
 obj-y                                          += pmap.o
 obj-y                                          += printf.o
 obj-y                                          += printfmt.o