# their Makelocal. This is useful, for example, to allow emacs to find the
# correct file when errors are encountered using its builtin 'M-x compile'
# command.
+VERSION = 0
+PATCHLEVEL = 1
+SUBLEVEL = 0
+EXTRAVERSION =
+VERNAME = Nanwan
+
+KERNELVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION)
+
+export KERNELVERSION VERNAME
+
NO_PRINT_DIRECTORY ?= --no-print-directory
# Save the ability to export the parent's original environment for future use
# generate for non-kbuild targets
OBJDIR ?= obj
+# Don't need to export these, since the Makelocal is included.
+KERNEL_OBJ := $(OBJDIR)/kern/akaros-kernel
+CMP_KERNEL_OBJ := $(KERNEL_OBJ).gz
+
# Symlinks
# =========================================================================
# We have a few symlinks so that code can include <arch/whatever.h>. This
PHONY += symlinks clean_symlinks
clean_symlinks: objclean
- @rm -f kern/include/arch kern/boot user/parlib/include/arch
+ @rm -f kern/include/arch kern/boot user/parlib/include/parlib/arch
arch-link := $(notdir $(shell readlink kern/include/arch))
valid-arches := $(notdir $(wildcard kern/arch/*))
@echo Making symlinks...
$(Q)ln -fs ../arch/$(ARCH) kern/include/arch
$(Q)ln -fs arch/$(ARCH)/boot kern/boot
- $(Q)ln -fs $(ARCH) user/parlib/include/arch
+ $(Q)ln -fs $(ARCH) user/parlib/include/parlib/arch
$(Q)$(MAKE) -f $(srctree)/Makefile clean
else
CFLAGS_KERNEL += -std=gnu99 -fgnu89-inline
CFLAGS_KERNEL += -fno-strict-aliasing -fno-omit-frame-pointer
CFLAGS_KERNEL += -fno-stack-protector
-CFLAGS_KERNEL += -Wall -Wno-format -Wno-unused
+CFLAGS_KERNEL += -Wall -Wno-format -Wno-unused -Werror
CFLAGS_KERNEL += -DROS_KERNEL
CFLAGS_KERNEL += -include include/generated/autoconf.h -include include/common.h
CFLAGS_KERNEL += -fplan9-extensions
else
CFLAGS_KERNEL += -m32 -gstabs
endif
+ifeq ($(CONFIG_BETTER_BACKTRACE),y)
+CFLAGS_KERNEL += -fno-optimize-sibling-calls
+endif
# TODO: do we need this, or can we rely on the compiler's defines?
CFLAGS_KERNEL += -D$(ARCH)
# kernel build output. Right now, it's only passed down to tests/
dummy-1 := $(shell mkdir -p $(OBJDIR)/kern/)
-# Don't need to export these, since the Makelocal is included.
-KERNEL_OBJ := $(OBJDIR)/kern/akaros-kernel
-CMP_KERNEL_OBJ := $(KERNEL_OBJ).gz
-
# Since we're doing this outside of the dot-config part, some targets, such as
# clean, won't read in our .config/auto.conf, and won't know about the
# KFS_PATH. Future rules related to KFS will have issues (mkdir with no
endif
FIRST_KFS_PATH = $(firstword $(kfs-paths))
+ABS_KFS_PATH = $(abspath $(FIRST_KFS_PATH))
-export OBJDIR FIRST_KFS_PATH
+export OBJDIR FIRST_KFS_PATH ABS_KFS_PATH
# Avoiding implicit rules
$(srctree)/Makelocal: ;
quiet_cmd_link-akaros = LINK $@
cmd_link-akaros = $(CONFIG_SHELL) scripts/link-kernel.sh $@ \
kern/arch/$(ARCH)/$(KERNEL_LD) $(LDFLAGS_KERNEL) \
+ --build-id=sha1 \
$(akaros-deps) $(gcc-lib) $(kern_cpio_obj) \
$(ext2_bdev_obj); \
$(ARCH_POST_LINK_CMD)
pthread: parlib benchutil
iplib: parlib
ndblib: iplib
-vmm: parlib
+vmm: parlib benchutil
PHONY += install-libs $(user-dirs)
install-libs: $(user-dirs) symlinks cc-exists
@$(MAKE) -C user/utest clean
# KFS related stuff
-PHONY += fill-kfs unfill-kfs create-build-file
+PHONY += fill-kfs unfill-kfs
xcc-gcc-libs = $(XCC_TARGET_ROOT)/../lib/
xcc-so-files = $(addprefix $(XCC_TARGET_LIB), *.so*) \
$(addprefix $(xcc-gcc-libs), *.so*)
-KERNEL_ELF_PATH=$(abspath $(KERNEL_OBJ))-64b
-create-build-file:
-ifneq ($(INVARIANT_BUILD),1)
- @echo "KernelPath: $(KERNEL_ELF_PATH)" > kern/kfs/etc/build.info
- @echo "KernelSize: $(shell stat -c %s $(KERNEL_ELF_PATH))" >> \
- kern/kfs/etc/build.info
- @echo "Date: `date`" >> kern/kfs/etc/build.info
- @echo "Host: `hostname`" >> kern/kfs/etc/build.info
-endif
-
$(OBJDIR)/.dont-force-fill-kfs:
$(Q)rm -rf $(addprefix $(FIRST_KFS_PATH)/lib/, $(notdir $(xcc-so-files)))
@echo "Cross Compiler 'so' files removed from KFS"
@echo "User space tests removed from KFS"
@touch $(OBJDIR)/.dont-force-fill-kfs
-fill-kfs: $(OBJDIR)/.dont-force-fill-kfs install-libs tests create-build-file
+fill-kfs: $(OBJDIR)/.dont-force-fill-kfs install-libs tests
@mkdir -p $(FIRST_KFS_PATH)/lib
$(Q)cp -uP $(xcc-so-files) $(FIRST_KFS_PATH)/lib
@echo "Cross Compiler 'so' files installed to KFS"
# Bundled apps
# =========================================================================
-PHONY += apps-install
-apps-install: install-libs
+app-dirs =
+tagged-app-dirs := $(subst /,__,$(app-dirs))
+app-dirs-install := $(addprefix _install_,$(tagged-app-dirs))
+app-dirs-clean := $(addprefix _clean_,$(tagged-app-dirs))
+
+PHONY += $(app-dirs-install) $(app-dirs-clean)
+
+$(app-dirs-install):
+ @$(MAKE) -C $(patsubst _install_%,%,$(subst __,/,$@)) install
+
+$(app-dirs-clean):
+ @$(MAKE) -C $(patsubst _clean_%,%,$(subst __,/,$@)) clean
+
+PHONY += apps-install
+apps-install: $(app-dirs-install)
@$(call make_as_parent, -C tools/apps/busybox)
- @$(call make_as_parent, -C tools/profile/kprof2perf install)
- @$(call make_as_parent, -C tools/apps/snc install)
- @$(call make_as_parent, -C tools/profile/perf install)
+ @$(call make_as_parent, -C tools/apps/ipconfig install)
+ @$(call make_as_parent, -C tools/dev-libs/elfutils install)
+ @$(call make_as_parent, -C tools/dev-util/perf install)
+ @$(call make_as_parent, -C tools/sys-apps/bash install)
PHONY += apps-clean
-apps-clean:
+apps-clean: $(app-dirs-clean)
@$(call make_as_parent, -C tools/apps/busybox clean)
- @$(call make_as_parent, -C tools/profile/kprof2perf clean)
- @$(call make_as_parent, -C tools/apps/snc clean)
- @$(call make_as_parent, -C tools/profile/perf clean)
+ @$(call make_as_parent, -C tools/apps/ipconfig clean)
+ @$(call make_as_parent, -C tools/dev-libs/elfutils clean)
+ @$(call make_as_parent, -C tools/dev-util/perf clean)
# Cross Compiler
# =========================================================================
@$(MAKE) userclean
@$(MAKE) install-libs
@$(MAKE) testclean utestclean
- @$(MAKE) tests utest
@$(call make_as_parent, apps-clean)
@$(call make_as_parent, apps-install)
+ @$(MAKE) tests utest
@$(MAKE) fill-kfs
@$(MAKE) akaros-kernel