root/Whitix/branches/khorben-libc/make.inc

Revision 1453, 1.0 KB (checked in by khorben, 4 years ago)

-m32 belongs to $(CC)

Line 
1#Define DEPTH before including this file
2
3.PHONY: clean
4.IGNORE: clean
5
6CC = gcc -m32
7CPP = gpp
8ASM = nasm
9RM  = rm -f
10SED = sed
11override CFLAGS += -fomit-frame-pointer -ffreestanding -fno-stack-protector -fno-builtin \
12        -nostdlib -Wall -Wextra -O2 -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 "CC $*.c"
22        @$(CC) $(CFLAGS) -c $*.c -o $*.o
23        @$(CC) -MM $(CFLAGS) -c $*.c > .deps/$*.d
24
25.SUFFIXES: .sys .c
26.c.sys:
27        @echo "CC $*.c"
28        @$(CC) $(CFLAGS) -DMODULE -fno-common -c $*.c -o $*.sys
29        @$(CC) -MM $(CFLAGS) -DMODULE -c $*.c > .deps/$*.d
30        @$(SED) -i "s/$*.o/$*.sys/" .deps/$*.d
31       
32#nasm assembly files
33
34.asm:
35        $(ASM) -f bin $*.asm -o
36        @echo "Compiling $*.asm"
37
38.s.o:
39        $(ASM) -f elf $*.s -o $*.o
40        @echo "Compiling $*.s"
41
42#gas assembly files
43.S.o:
44        @$(CC) -ffreestanding -fleading-underscore -fno-builtin -c $*.S -o $*.o
45        @echo "AS $*.S"
46
47ifneq ($(IGNORE_CLEAN), y)
48clean:
49        -rm -f *.o *.sys .deps/*.d
50endif
Note: See TracBrowser for help on using the browser.