git://scm.lunaixsky.com
/
lunaix-os.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Introducing LunaBuild to the build flow (#36)
[lunaix-os.git]
/
lunaix-os
/
kernel.mk
diff --git
a/lunaix-os/kernel.mk
b/lunaix-os/kernel.mk
index 189e97046385d7ffa581e5e52467bbf3cab2f3b3..9399e7154c0e26cf6db7800767f57d3468576a1c 100644
(file)
--- a/
lunaix-os/kernel.mk
+++ b/
lunaix-os/kernel.mk
@@
-1,45
+1,33
@@
include os.mkinc
include toolchain.mkinc
include os.mkinc
include toolchain.mkinc
-kexclusion = $(shell cat ksrc.excludes)
-
-define ksrc_dirs
- kernel
- hal
- libs
- arch/$(ARCH)
-endef
-
-define kinc_dirs
- includes
- includes/usr
- arch/$(ARCH)/includes
-endef
-
+ksrc_files = $(shell cat .builder/sources.list)
+kinc_dirs = $(shell cat .builder/includes.list)
+khdr_files = $(shell cat .builder/headers.list)
+khdr_files += .builder/configs.h
kbin_dir := $(BUILD_DIR)
kbin := $(BUILD_NAME)
kbin_dir := $(BUILD_DIR)
kbin := $(BUILD_NAME)
-ksrc_files := $(foreach f, $(ksrc_dirs), $(shell find $(f) -name "*.[cS]"))
-ksrc_files := $(filter-out $(kexclusion),$(ksrc_files))
ksrc_objs := $(addsuffix .o,$(ksrc_files))
ksrc_deps := $(addsuffix .d,$(ksrc_files))
ksrc_objs := $(addsuffix .o,$(ksrc_files))
ksrc_deps := $(addsuffix .d,$(ksrc_files))
-
+khdr_opts := $(addprefix -include ,$(khdr_files))
kinc_opts := $(addprefix -I,$(kinc_dirs))
tmp_kbin := $(BUILD_DIR)/tmpk.bin
ksymtable := lunaix_ksyms.o
kinc_opts := $(addprefix -I,$(kinc_dirs))
tmp_kbin := $(BUILD_DIR)/tmpk.bin
ksymtable := lunaix_ksyms.o
-CFLAGS += -include flags.h
-CFLAGS += -include config.h
+CFLAGS += $(khdr_opts)
+
+-include $(ksrc_deps)
-%.S.o: %.S
+%.S.o: %.S
$(khdr_files) kernel.mk
$(call status_,AS,$<)
$(call status_,AS,$<)
- @$(CC) $(CFLAGS) $(kinc_opts) -c $< -o $@
+ @$(CC) $(CFLAGS) $(kinc_opts) -
MMD -MP -
c $< -o $@
-%.c.o: %.c
+%.c.o: %.c
$(khdr_files) kernel.mk
$(call status_,CC,$<)
$(call status_,CC,$<)
- @$(CC) $(CFLAGS) $(kinc_opts) -c $< -o $@
+ @$(CC) $(CFLAGS) $(kinc_opts) -
MMD -MP -
c $< -o $@
$(tmp_kbin): $(ksrc_objs)
$(call status_,LD,$@)
$(tmp_kbin): $(ksrc_objs)
$(call status_,LD,$@)