root/Whitix/tags/0.2b/make.inc

Revision 1858, 0.9 KB (checked in by mwhitworth, 3 years ago)

Simplify build, add colored prints (easier to read).

Line 
1#Define DEPTH before including this file
2
3.PHONY: clean
4.IGNORE: clean
5
6CC = gcc
7CPP = gpp
8ASM = nasm
9RM  = rm -f
10SED = sed
11override CFLAGS += -g -ffreestanding -fno-stack-protector -fno-builtin \
12        -nostdlib -m32 -Wall -Wextra -Os -I$(DEPTH)include -Wno-unused-parameter
13BE_VERBOSE = 0
14LD_R_FLAGS = -r -melf_i386
15
16# Build the dependency list
17DEPS := $(MODULES:%.sys=.deps/%.d)
18DEPS += $(OBJS:%.o=.deps/%.d)
19
20%.o : %.c
21        @echo "  \033[32mCC $*.c"
22        @tput sgr0
23        @$(CC) $(CFLAGS) -c $*.c -o $*.o
24        @$(CC) -MM $(CFLAGS) -c $*.c > .deps/$*.d
25
26%.sys : %.c
27        @echo "  \033[32mCC $*.c"
28        @tput sgr0
29        @$(CC) $(CFLAGS) -DMODULE -fno-common -c $*.c -o $*.sys
30        @$(CC) -MM $(CFLAGS) -DMODULE -c $*.c > .deps/$*.d
31        @$(SED) -i "s/$*.o/$*.sys/" .deps/$*.d
32
33#gas assembly files
34%.o : %.S
35        $(CC) -I$(DEPTH)include -ffreestanding -fleading-underscore -fno-builtin -m32 -c $*.S -o $*.o
36#       @echo "AS $*.S"
37
38ifneq ($(IGNORE_CLEAN), y)
39clean:
40        -rm -f *.o *.sys .deps/*.d
41endif
Note: See TracBrowser for help on using the browser.