summaryrefslogtreecommitdiffstats
path: root/apps/init/Makefile
blob: 1834d0b62472770087b4fc646dbccaa848e70a4b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
include $(CONFIG)

CFILES := $(wildcard *.c)
CFILES += $(wildcard arch/$(TARGET_MACHINE)/*.c)
OFILES := $(patsubst %.c,%.o,$(CFILES))
OFILES += $(STATICLIBS) 

CFLAGS := -ffreestanding -nostdlib -g
LDFLAGS := -T arch/$(TARGET_MACHINE)/link.ld
OCFLAGS := -O binary \
		   --set-section-flags .bss=alloc,load,contents

all: $(OFILES)
	$(LD) $(LDFLAGS) ${OFILES} -o init.elf
	objcopy $(OCFLAGS) init.elf $(OUT)/init

clean:
	-rm ${OFILES}
	-rm init.elf

%.o:%.c
	$(CC) $(CFLAGS) -c $< -o $@