make em make less make, cuz makin' make ain't make no fun
This commit is contained in:
@@ -23,4 +23,4 @@ Checks: >
|
|||||||
-cppcoreguidelines-pro-*,
|
-cppcoreguidelines-pro-*,
|
||||||
CheckOptions:
|
CheckOptions:
|
||||||
readability-simplify-boolean-expr.IgnoreMacros: 'true'
|
readability-simplify-boolean-expr.IgnoreMacros: 'true'
|
||||||
readability-identifier-length.IgnoreNames: 'me'
|
readability-identifier-length.IgnoreNames: 'g,me'
|
||||||
|
|||||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,2 +1 @@
|
|||||||
.build*
|
build/
|
||||||
/build*
|
|
||||||
|
|||||||
@@ -13,8 +13,31 @@ INITRD = $(BUILDDIR)/initrd.img
|
|||||||
|
|
||||||
all: $(INITRD)
|
all: $(INITRD)
|
||||||
|
|
||||||
|
# Rezepte fuer Apps (Unterverzeichnisse)
|
||||||
|
$(APPS): $(BUILDDIR)/init.o
|
||||||
|
$(VERBOSE) $(MAKE) -C $@ -f ../Makefile.app
|
||||||
|
|
||||||
|
# recipe for compiling imgbuilder
|
||||||
|
$(IMGBUILDER): imgbuilder.cc $(MAKEFILE_LIST)
|
||||||
|
@echo "CC $@"
|
||||||
|
@if test \( ! \( -d $(@D) \) \) ;then mkdir -p $(@D);fi
|
||||||
|
$(VERBOSE) $(CXX) -std=c++23 -o $@ $<
|
||||||
|
|
||||||
# recipe for building the final oostubs image
|
# recipe for building the final oostubs image
|
||||||
$(INITRD):
|
$(INITRD): $(APPS) $(IMGBUILDER)
|
||||||
@echo "IMGBUILD $@"
|
@echo "IMGBUILD $@"
|
||||||
@mkdir -p $(@D)
|
@if test \( ! \( -d $(@D) \) \) ;then mkdir -p $(@D);fi
|
||||||
@touch $@
|
$(VERBOSE) $(IMGBUILDER) $(addsuffix $(BUILDDIR)/app.img, $(APPS)) > $@
|
||||||
|
|
||||||
|
lint::
|
||||||
|
$(VERBOSE) $(foreach APP,$(APPS),$(MAKE) -C $(APP) -f ../Makefile.app lint && ) true
|
||||||
|
|
||||||
|
tidy::
|
||||||
|
$(VERBOSE) $(foreach APP,$(APPS),$(MAKE) -C $(APP) -f ../Makefile.app tidy && ) true
|
||||||
|
|
||||||
|
# clean all apps additionally to default clean recipe from common.mk
|
||||||
|
clean::
|
||||||
|
$(VERBOSE) $(foreach APP,$(APPS),$(MAKE) -C $(APP) -f ../Makefile.app clean && ) true
|
||||||
|
|
||||||
|
.PHONY: all clean $(APPS)
|
||||||
|
|
||||||
|
|||||||
53
user/Makefile.app
Normal file
53
user/Makefile.app
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
# --------------------------------------------------------------------------
|
||||||
|
# Linker Script
|
||||||
|
LINKER_SCRIPT = ../sections.ld
|
||||||
|
# Files to be compiled (important: defined prior to importing common.mk!)
|
||||||
|
CC_SOURCES = $(shell find * -name "*.cc" -a ! -name '.*' )
|
||||||
|
ASM_SOURCES = $(shell find * -name "*.asm" -a ! -name '.*' )
|
||||||
|
|
||||||
|
CXXFLAGS_INCLUDE = -I../../libsys -I../../kernel
|
||||||
|
CXXFLAGS_DEFAULT += $(CXXFLAGS_INCLUDE)
|
||||||
|
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
# Globale Variablen und Standard-Rezepte einbinden
|
||||||
|
include ../../tools/common.mk
|
||||||
|
|
||||||
|
# --------------------------------------------------------------------------
|
||||||
|
# Default target
|
||||||
|
|
||||||
|
.DEFAULT_GOAL = all
|
||||||
|
all: $(BUILDDIR)/app.img
|
||||||
|
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
# Parameters & flags:
|
||||||
|
|
||||||
|
CXXFLAGS += $(CXXFLAGS_INCLUDE)
|
||||||
|
# Enable 16-byte compare-and-exchange instruction for debugging purposes (stack alignment)
|
||||||
|
CXXFLAGS += -mcx16
|
||||||
|
|
||||||
|
LDLIBS += -L../../libsys/$(BUILDDIR) -lsys
|
||||||
|
INITOBJ = ../$(BUILDDIR)/init.o
|
||||||
|
|
||||||
|
# --------------------------------------------------------------------------
|
||||||
|
# Linked applications
|
||||||
|
$(BUILDDIR)/app: $(INITOBJ) $(ASM_OBJECTS) $(CC_OBJECTS) $(LINKER_SCRIPT) $(MAKEFILE_LIST)
|
||||||
|
@echo "LD $@"
|
||||||
|
@mkdir -p $(@D)
|
||||||
|
$(VERBOSE) $(CXX) $(CXXFLAGS) -Wl,-T $(LINKER_SCRIPT) -o $@ $(LDFLAGS) $(INITOBJ) $(ASM_OBJECTS) $(CC_OBJECTS) $(LDLIBS)
|
||||||
|
|
||||||
|
# --------------------------------------------------------------------------
|
||||||
|
# 'app.img' contains all section required for loading an application (flat binary)
|
||||||
|
|
||||||
|
$(BUILDDIR)/app.img: $(BUILDDIR)/app
|
||||||
|
@echo "OBJCOPY $@"
|
||||||
|
@if ! nm $< | grep "4000000 T start" >/dev/null 2>&1 ; then echo "Symbol 'start' is not first address" ; exit 1 ; fi
|
||||||
|
@if test \( ! \( -d $(@D) \) \) ;then mkdir -p $(@D);fi
|
||||||
|
$(VERBOSE) objcopy -O binary --set-section-flags .bss=alloc,load,contents $< $@
|
||||||
|
|
||||||
|
# --------------------------------------------------------------------------
|
||||||
|
# Include dependency files (generated gcc -MM)
|
||||||
|
|
||||||
|
ifneq ($(MAKECMDGOALS),clean)
|
||||||
|
-include $(DEP_FILES)
|
||||||
|
endif
|
||||||
|
|
||||||
Reference in New Issue
Block a user