Build system: Prettify build
This commit is contained in:
parent
00f9981f51
commit
054d5a8bb4
22
Makefile
22
Makefile
@ -5,22 +5,22 @@ AR := x86_64-luna-ar
|
|||||||
LD := x86_64-luna-ld
|
LD := x86_64-luna-ld
|
||||||
|
|
||||||
build:
|
build:
|
||||||
tools/sync-libc.sh
|
+@tools/sync-libc.sh
|
||||||
@$(MAKE) -C kernel build
|
+@tools/buildstep.sh kernel build
|
||||||
@$(MAKE) -C libs build
|
+@tools/buildstep.sh libs build
|
||||||
@$(MAKE) -C apps build
|
+@tools/buildstep.sh apps build
|
||||||
|
|
||||||
clean: initrd-clean
|
clean: initrd-clean
|
||||||
@$(MAKE) -C kernel clean
|
+@tools/buildstep.sh kernel clean
|
||||||
@$(MAKE) -C libs clean
|
+@tools/buildstep.sh libs clean
|
||||||
@$(MAKE) -C apps clean
|
+@tools/buildstep.sh apps clean
|
||||||
|
|
||||||
initrd-clean:
|
initrd-clean:
|
||||||
rm -f $(LUNA_ROOT)/initrd/boot/moon $(LUNA_ROOT)/Luna.iso
|
rm -f $(LUNA_ROOT)/initrd/boot/moon $(LUNA_ROOT)/Luna.iso
|
||||||
rm -rf $(LUNA_ROOT)/initrd/bin
|
rm -rf $(LUNA_ROOT)/initrd/bin
|
||||||
|
|
||||||
install:
|
install:
|
||||||
@$(MAKE) -C kernel install
|
+@tools/buildstep.sh kernel install
|
||||||
@$(MAKE) -C libs install
|
+@tools/buildstep.sh libs install
|
||||||
@$(MAKE) -C apps install
|
+@tools/buildstep.sh apps install
|
||||||
@tools/install-built-ports.sh
|
+@tools/install-built-ports.sh
|
@ -10,13 +10,15 @@ CFLAGS := -Wall -Wextra -Werror -Os -fno-asynchronous-unwind-tables -ffunction-s
|
|||||||
|
|
||||||
$(APPS_BIN)/%: $(APPS_SRC)/%.c
|
$(APPS_BIN)/%: $(APPS_SRC)/%.c
|
||||||
@mkdir -p $(@D)
|
@mkdir -p $(@D)
|
||||||
$(CC) $(CFLAGS) -o $@ $^
|
@$(CC) $(CFLAGS) -o $@ $^
|
||||||
|
@echo " CC $^"
|
||||||
|
|
||||||
build: $(REAL_APPS)
|
build: $(REAL_APPS)
|
||||||
|
|
||||||
install: $(REAL_APPS)
|
install: $(REAL_APPS)
|
||||||
@mkdir -p $(LUNA_ROOT)/initrd/bin
|
@mkdir -p $(LUNA_ROOT)/initrd/bin
|
||||||
cp $(REAL_APPS) $(LUNA_ROOT)/initrd/bin
|
@cp $(REAL_APPS) $(LUNA_ROOT)/initrd/bin
|
||||||
|
@echo " INSTALL $(REAL_APPS)"
|
||||||
@chmod a+s $(LUNA_ROOT)/initrd/bin/su
|
@chmod a+s $(LUNA_ROOT)/initrd/bin/su
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
@ -31,35 +31,43 @@ default: $(MOON_BIN)/moon
|
|||||||
|
|
||||||
$(MOON_OBJ)/main.cpp.o: $(MOON_SRC)/main.cpp
|
$(MOON_OBJ)/main.cpp.o: $(MOON_SRC)/main.cpp
|
||||||
@mkdir -p $(@D)
|
@mkdir -p $(@D)
|
||||||
$(CXX) $(CFLAGS) -fno-stack-protector $(CXXFLAGS) -o $@ -c $^
|
@$(CXX) $(CFLAGS) -fno-stack-protector $(CXXFLAGS) -o $@ -c $^
|
||||||
|
@echo " CXX $^"
|
||||||
|
|
||||||
$(MOON_OBJ)/misc/config.cpp.o: $(MOON_SRC)/misc/config.cpp FORCE
|
$(MOON_OBJ)/misc/config.cpp.o: $(MOON_SRC)/misc/config.cpp FORCE
|
||||||
@mkdir -p $(@D)
|
@mkdir -p $(@D)
|
||||||
$(CXX) $(CFLAGS) $(CXXFLAGS) -o $@ -c $(MOON_SRC)/misc/config.cpp
|
@$(CXX) $(CFLAGS) $(CXXFLAGS) -o $@ -c $(MOON_SRC)/misc/config.cpp
|
||||||
|
@echo " CXX $^"
|
||||||
|
|
||||||
$(MOON_OBJ)/init/Init.cpp.o: $(MOON_SRC)/init/Init.cpp
|
$(MOON_OBJ)/init/Init.cpp.o: $(MOON_SRC)/init/Init.cpp
|
||||||
@mkdir -p $(@D)
|
@mkdir -p $(@D)
|
||||||
$(CXX) $(CFLAGS) -fno-stack-protector $(CXXFLAGS) -o $@ -c $^
|
@$(CXX) $(CFLAGS) -fno-stack-protector $(CXXFLAGS) -o $@ -c $^
|
||||||
|
@echo " CXX $^"
|
||||||
|
|
||||||
$(MOON_OBJ)/%.cpp.o: $(MOON_SRC)/%.cpp
|
$(MOON_OBJ)/%.cpp.o: $(MOON_SRC)/%.cpp
|
||||||
@mkdir -p $(@D)
|
@mkdir -p $(@D)
|
||||||
$(CXX) $(CFLAGS) $(CXXFLAGS) -o $@ -c $^
|
@$(CXX) $(CFLAGS) $(CXXFLAGS) -o $@ -c $^
|
||||||
|
@echo " CXX $^"
|
||||||
|
|
||||||
$(MOON_OBJ)/memory/liballoc/liballoc.c.o: $(MOON_SRC)/memory/liballoc/liballoc.c
|
$(MOON_OBJ)/memory/liballoc/liballoc.c.o: $(MOON_SRC)/memory/liballoc/liballoc.c
|
||||||
@mkdir -p $(@D)
|
@mkdir -p $(@D)
|
||||||
$(CC) $(CFLAGS) -fno-sanitize=undefined -o $@ -c $^
|
@$(CC) $(CFLAGS) -fno-sanitize=undefined -o $@ -c $^
|
||||||
|
@echo " CC $^"
|
||||||
|
|
||||||
$(MOON_OBJ)/%.c.o: $(MOON_SRC)/%.c
|
$(MOON_OBJ)/%.c.o: $(MOON_SRC)/%.c
|
||||||
@mkdir -p $(@D)
|
@mkdir -p $(@D)
|
||||||
$(CC) $(CFLAGS) -o $@ -c $^
|
@$(CC) $(CFLAGS) -o $@ -c $^
|
||||||
|
@echo " CC $^"
|
||||||
|
|
||||||
$(MOON_OBJ)/%.asm.o: $(MOON_SRC)/%.asm
|
$(MOON_OBJ)/%.asm.o: $(MOON_SRC)/%.asm
|
||||||
@mkdir -p $(@D)
|
@mkdir -p $(@D)
|
||||||
$(ASM) $(ASMFLAGS) -o $@ $^
|
@$(ASM) $(ASMFLAGS) -o $@ $^
|
||||||
|
@echo " ASM $^"
|
||||||
|
|
||||||
build: $(OBJS)
|
build: $(OBJS)
|
||||||
@mkdir -p $(MOON_BIN)
|
@mkdir -p $(MOON_BIN)
|
||||||
$(CC) $(OBJS) $(LDFLAGS) -o $(MOON_BIN)/moon
|
@$(CC) $(OBJS) $(LDFLAGS) -o $(MOON_BIN)/moon
|
||||||
|
@echo " CCLD $(MOON_BIN)/moon"
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf $(MOON_OBJ)/*
|
rm -rf $(MOON_OBJ)/*
|
||||||
@ -67,9 +75,11 @@ clean:
|
|||||||
|
|
||||||
install: $(MOON_BIN)/moon
|
install: $(MOON_BIN)/moon
|
||||||
@mkdir -p $(LUNA_ROOT)/initrd/boot
|
@mkdir -p $(LUNA_ROOT)/initrd/boot
|
||||||
cp $^ $(LUNA_ROOT)/initrd/boot/moon
|
@cp $^ $(LUNA_ROOT)/initrd/boot/moon
|
||||||
$(LUNA_ROOT)/tools/generate-symbols.sh
|
@echo " INSTALL $^"
|
||||||
$(STRIP) $(LUNA_ROOT)/initrd/boot/moon
|
@$(LUNA_ROOT)/tools/generate-symbols.sh
|
||||||
|
@$(STRIP) $(LUNA_ROOT)/initrd/boot/moon
|
||||||
|
@echo " STRIP $(LUNA_ROOT)/initrd/boot/moon"
|
||||||
|
|
||||||
.PHONY: build clean install FORCE
|
.PHONY: build clean install FORCE
|
||||||
FORCE:
|
FORCE:
|
@ -21,49 +21,60 @@ OBJS += $(patsubst $(LIBC_SRC)/%.asm, $(LIBC_OBJ)/%.asm.o, $(ASM_SRC))
|
|||||||
|
|
||||||
$(LIBC_OBJ)/%.cpp.o: $(LIBC_SRC)/%.cpp
|
$(LIBC_OBJ)/%.cpp.o: $(LIBC_SRC)/%.cpp
|
||||||
@mkdir -p $(@D)
|
@mkdir -p $(@D)
|
||||||
$(CXX) $(CFLAGS) $(CXXFLAGS) -o $@ -c $^
|
@$(CXX) $(CFLAGS) $(CXXFLAGS) -o $@ -c $^
|
||||||
|
@echo " CXX $^"
|
||||||
|
|
||||||
$(LIBC_OBJ)/%.c.o: $(LIBC_SRC)/%.c
|
$(LIBC_OBJ)/%.c.o: $(LIBC_SRC)/%.c
|
||||||
@mkdir -p $(@D)
|
@mkdir -p $(@D)
|
||||||
$(CC) $(CFLAGS) -o $@ -c $^
|
@$(CC) $(CFLAGS) -o $@ -c $^
|
||||||
|
@echo " CC $^"
|
||||||
|
|
||||||
$(LIBC_OBJ)/%.asm.o: $(LIBC_SRC)/%.asm
|
$(LIBC_OBJ)/%.asm.o: $(LIBC_SRC)/%.asm
|
||||||
@mkdir -p $(@D)
|
@mkdir -p $(@D)
|
||||||
$(ASM) $(ASMFLAGS) -o $@ $^
|
@$(ASM) $(ASMFLAGS) -o $@ $^
|
||||||
|
@echo " ASM $^"
|
||||||
|
|
||||||
$(LIBC_BIN)/libc.a: $(OBJS)
|
$(LIBC_BIN)/libc.a: $(OBJS)
|
||||||
@mkdir -p $(@D)
|
@mkdir -p $(@D)
|
||||||
$(AR) rcs $@ $(OBJS)
|
@$(AR) rcs $@ $(OBJS)
|
||||||
|
@echo " AR $@"
|
||||||
|
|
||||||
$(LIBC_BIN)/crt0.o: $(LIBC_DIR)/crt0.asm
|
$(LIBC_BIN)/crt0.o: $(LIBC_DIR)/crt0.asm
|
||||||
@mkdir -p $(@D)
|
@mkdir -p $(@D)
|
||||||
$(ASM) $(ASMFLAGS) -o $@ $^
|
@$(ASM) $(ASMFLAGS) -o $@ $^
|
||||||
|
@echo " ASM $^"
|
||||||
|
|
||||||
$(LIBC_BIN)/crti.o: $(LIBC_DIR)/crti.asm
|
$(LIBC_BIN)/crti.o: $(LIBC_DIR)/crti.asm
|
||||||
@mkdir -p $(@D)
|
@mkdir -p $(@D)
|
||||||
$(ASM) $(ASMFLAGS) -o $@ $^
|
@$(ASM) $(ASMFLAGS) -o $@ $^
|
||||||
|
@echo " ASM $^"
|
||||||
|
|
||||||
$(LIBC_BIN)/crtn.o: $(LIBC_DIR)/crtn.asm
|
$(LIBC_BIN)/crtn.o: $(LIBC_DIR)/crtn.asm
|
||||||
@mkdir -p $(@D)
|
@mkdir -p $(@D)
|
||||||
$(ASM) $(ASMFLAGS) -o $@ $^
|
@$(ASM) $(ASMFLAGS) -o $@ $^
|
||||||
|
@echo " ASM $^"
|
||||||
|
|
||||||
build: $(LIBC_BIN)/crt0.o $(LIBC_BIN)/crti.o $(LIBC_BIN)/crtn.o $(LIBC_BIN)/libc.a
|
build: $(LIBC_BIN)/crt0.o $(LIBC_BIN)/crti.o $(LIBC_BIN)/crtn.o $(LIBC_BIN)/libc.a
|
||||||
|
|
||||||
$(DESTDIR)/libc.a: $(LIBC_BIN)/libc.a
|
$(DESTDIR)/libc.a: $(LIBC_BIN)/libc.a
|
||||||
@mkdir -p $(@D)
|
@mkdir -p $(@D)
|
||||||
cp $^ $@
|
@cp $^ $@
|
||||||
|
@echo " INSTALL $^"
|
||||||
|
|
||||||
$(DESTDIR)/crt0.o: $(LIBC_BIN)/crt0.o
|
$(DESTDIR)/crt0.o: $(LIBC_BIN)/crt0.o
|
||||||
@mkdir -p $(@D)
|
@mkdir -p $(@D)
|
||||||
cp $^ $@
|
@cp $^ $@
|
||||||
|
@echo " INSTALL $^"
|
||||||
|
|
||||||
$(DESTDIR)/crti.o: $(LIBC_BIN)/crti.o
|
$(DESTDIR)/crti.o: $(LIBC_BIN)/crti.o
|
||||||
@mkdir -p $(@D)
|
@mkdir -p $(@D)
|
||||||
cp $^ $@
|
@cp $^ $@
|
||||||
|
@echo " INSTALL $^"
|
||||||
|
|
||||||
$(DESTDIR)/crtn.o: $(LIBC_BIN)/crtn.o
|
$(DESTDIR)/crtn.o: $(LIBC_BIN)/crtn.o
|
||||||
@mkdir -p $(@D)
|
@mkdir -p $(@D)
|
||||||
cp $^ $@
|
@cp $^ $@
|
||||||
|
@echo " INSTALL $^"
|
||||||
|
|
||||||
install: $(DESTDIR)/libc.a $(DESTDIR)/crt0.o $(DESTDIR)/crti.o $(DESTDIR)/crtn.o
|
install: $(DESTDIR)/libc.a $(DESTDIR)/crt0.o $(DESTDIR)/crti.o $(DESTDIR)/crtn.o
|
||||||
|
|
||||||
|
9
tools/buildstep.sh
Executable file
9
tools/buildstep.sh
Executable file
@ -0,0 +1,9 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
unset -f filter-lines
|
||||||
|
filter-lines()
|
||||||
|
{
|
||||||
|
sed $'s|^|\x1b[32m('"$1/$2"$')\x1b[39m |'
|
||||||
|
}
|
||||||
|
|
||||||
|
make -C $1 $2 | filter-lines $1 $2
|
@ -7,5 +7,7 @@ cd $LUNA_ROOT
|
|||||||
|
|
||||||
tools/install-headers.sh
|
tools/install-headers.sh
|
||||||
|
|
||||||
make -C libs/libc build -j$(nproc)
|
cd libs/
|
||||||
make -C libs/libc install -j$(nproc)
|
|
||||||
|
$LUNA_ROOT/tools/buildstep.sh libc build
|
||||||
|
$LUNA_ROOT/tools/buildstep.sh libc install
|
Loading…
Reference in New Issue
Block a user