3 OUTBIN
:= $(OUTELF
).bin
7 # Include the config and rules.
9 include target
/$(TARGET
)/rules.mk
10 include platform
/$(PLATFORM
)/rules.mk
14 CFLAGS
+= -std
=c99
-Wall
-Wextra
-nostdlib
-ffreestanding
-lgcc
$(CCFLAGS
)
17 CPPFLAGS
:= -Iinclude
-Ikernel
/include -Iarch
/$(ARCH
)/include -Itarget
/$(TARGET
)/include -Iplatform
/$(PLATFORM
)/include
19 # Get a list of source files.
20 CSRC
:= $(shell find arch
/$(ARCH
) -type f
-name
"*.c") $(shell find kernel
-type f
-name
"*.c") \
21 $(shell find target
/$(TARGET
) -type f
-name
"*.c") $(shell find platform
/$(PLATFORM
) -type f
-name
"*.c")
23 ASMSRC
:= $(shell find arch
/$(ARCH
) -type f
-name
"*.S") $(shell find kernel
-type f
-name
"*.S") \
24 $(shell find target
/$(TARGET
) -type f
-name
"*.S") $(shell find platform
/$(PLATFORM
) -type f
-name
"*.S")
26 # Get the object files.
27 OBJ
:= $(patsubst %.S
,%.o
,$(ASMSRC
)) $(patsubst %.c
,%.o
,$(CSRC
))
29 # Get the dependancies.
30 DEP
:= $(patsubst %.S
,%.d
,$(ASMSRC
)) $(patsubst %.c
,%.d
,$(CSRC
))
33 LINK
:= arch
/$(ARCH
)/link.
ld
36 MAKEDEPS
:= Makefile rules.mk config.mk target
/$(TARGET
)/rules.mk platform
/$(PLATFORM
)/rules.mk
45 $(OUTELF
): $(OBJ
) $(LINK
)
46 $(HOSTLD
) $(OBJ
) -T
$(LINK
) -o
$@
50 $(HOSTOBJCOPY
) $(OUTELF
) -O binary
$@
52 # Include dependancy files.
57 -$(RM
) $(wildcard $(OBJ
) $(DEP
) $(OUTELF
) $(OUTFORMAT
))
61 $(warning Experimental dog generator. Don
't try it out; the default size isn't set
, so-
)
65 $(HOSTCC
) $(CFLAGS
) $(CPPFLAGS
) -MMD
-MP
-c
$< -o
$@
69 $(HOSTCC
) $(CFLAGS
) $(CPPFLAGS
) -MMD
-MP
-c
$< -o
$@