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

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

CFLAGS := -ffreestanding -nostdlib -g
LDFLAGS := -T $(TARGET_MACHINE).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 $@