Build chain tweaks and cleanup

This commit is contained in:
2022-01-11 18:12:57 +01:00
parent 6c36d3dd40
commit fc54366eec
5 changed files with 36 additions and 26 deletions

View File

@@ -20,23 +20,27 @@ kernel: $(OBJ)
%.o: %.S.py
python3 $^ | $(COMPILE.S) $(DEPFLAGS) -x assembler-with-cpp - -o $@
# Automatic dependency tracking
DEP := $(OBJ:.o=.d)
DEPFLAGS = -MT $@ -MMD -MP -MF $*.d
$(OBJ): CPPFLAGS += $(DEPFLAGS)
%.d: ;
# Installation
DESTDIR ?= $(BUILDROOT)/sysroot
$(DESTDIR)$(PREFIX)/kernel: kernel
$(DESTDIR)/kernel: kernel
install -D $< $@
install: $(DESTDIR)$(PREFIX)/kernel
install: $(DESTDIR)/kernel
clean:
rm -rf $(OBJ) $(DEP) kernel
.PHONY: install
.PHONY: install clean
# Include automatic dependency rules
include $(DEP)

View File

@@ -1,12 +1,9 @@
#include <stdint.h>
#include <multiboot.h>
#include <cpu.h>
#include <memory.h>
#include <terminal.h>
#include <debug.h>
#include <multiboot.h>
#include <interrupts.h>
#include <stdlib.h>
#include <stdio.h>
#include <proc.h>
void TEMP_test_scheduler();

View File

@@ -6,7 +6,6 @@ CC := ${TARGET}-gcc
SRC := $(shell find -type f -name '*.[cS]*')
OBJ := $(patsubst %, %.o, $(basename $(basename $(SRC))))
HDR := $(shell find -type f -name '*.h')
CFLAGS := -Wall -Wextra -pedantic -ffreestanding -mcmodel=large -std=c2x
@@ -18,15 +17,19 @@ LDFLAGS := -nostdlib -r
libmittos.a: $(OBJ)
$(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@
# Automatic dependency tracking
DEP := $(OBJ:.o=.d)
DEPFLAGS = -MT $@ -MMD -MP -MF $*.d
$(OBJ): CPPFLAGS += $(DEPFLAGS)
%.d: ;
# Installation
DESTDIR ?= $(BUILDROOT)/sysroot
LIBDIR := $(DESTDIR)/usr/lib
INCDIR := $(DESTDIR)/usr/include/mittos
$(LIBDIR)/libmittos.a: libmittos.a
install -D $< $@
@@ -38,9 +41,11 @@ install: install-headers $(LIBDIR)/libmittos.a
install-headers: $(HDR:./include/%=$(INCDIR)/%)
clean:
rm -rf $(OBJ) $(DEP) libmittos.a
.PHONY: install install-headers
.PHONY: install install-headers clean
# Include automatic dependency rules
include $(DEP)