-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
47 lines (37 loc) · 1.85 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# MIT License, Copyright (c) 2020 Marvin Borner
CONFIG ?= dev
include .build.mk
define PREPROCESSOR_FLAG_TEMPLATE =
-D$(1)=$(if $(filter $($(1)),true),1,0)
endef
PREPROCESSOR_FLAGS = $(foreach flag, $(ALL_PREPROCESSOR_FLAGS), $(call PREPROCESSOR_FLAG_TEMPLATE,$(flag)))
CFLAGS_WARNINGS = -Wall -Wextra -Werror -Wshadow -Wpointer-arith -Wwrite-strings -Wredundant-decls -Wnested-externs -Wformat=2 -Wmissing-declarations -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual -Wswitch-default -Wswitch-enum -Wunreachable-code -Wundef -Wold-style-definition -Wvla -pedantic-errors
CFLAGS_DEFAULT = $(CFLAGS_WARNINGS) -std=c99 -m32 -nostdlib -nostdinc -fno-builtin -fno-profile-generate -fno-omit-frame-pointer -fno-common -fno-asynchronous-unwind-tables -mno-red-zone -mno-mmx -mno-sse -mno-sse2 $(CONFIG_OPTIMIZATION) $(CONFIG_EXTRA_CFLAGS) $(PREPROCESSOR_FLAGS)
CC = $(CONFIG_CACHE) $(PWD)/cross/opt/bin/i686-elf-gcc
LD = $(CONFIG_CACHE) $(PWD)/cross/opt/bin/i686-elf-ld
OC = $(CONFIG_CACHE) $(PWD)/cross/opt/bin/i686-elf-objcopy
ST = $(CONFIG_CACHE) $(PWD)/cross/opt/bin/i686-elf-strip
AS = $(CONFIG_CACHE) nasm
BUILD = $(PWD)/build/
KERNEL = $(PWD)/kernel/
LIBS = $(PWD)/libs/
all: compile
export
compile:
@echo Using '$(CONFIG)' config
@$(MAKE) clean --no-print-directory -C libs/libc/
@$(MAKE) libc --no-print-directory -C libs/libc/
@echo "Compiled libc"
@$(MAKE) clean --no-print-directory -C libs/libc/
@$(MAKE) libk --no-print-directory -C libs/libc/
@echo "Compiled libk"
@$(MAKE) --no-print-directory -C libs/libgui/
@echo "Compiled libgui"
@$(MAKE) --no-print-directory -C libs/libtxt/
@echo "Compiled libtxt"
@$(MAKE) --no-print-directory -C kernel/
@echo "Compiled kernel"
@$(MAKE) --no-print-directory -C apps/
@echo "Compiled apps"
clean:
@find kernel/ apps/ libs/ boot/ \( -name "*.o" -or -name "*.a" -or -name "*.elf" -or -name "*.bin" \) -type f -delete