feat: wrapper function for bootstraping user program
[lunaix-os.git] / lunaix-os / makefile.usr
1 include config/make-cc
2 include config/make-os
3 include config/make-locations
4
5 SRC_DIRS := usr
6
7 SRC_FILES := $(foreach f, $(SRC_DIRS), $(shell find $(f) -name "*.[cS]"))
8
9 OBJS := $(foreach f, $(SRC_FILES), $(OBJECT_DIR)/$(f).o)
10
11 $(OBJECT_DIR)/%.S.o: %.S
12         @mkdir -p $(@D)
13         @echo "  CC    $<"
14         @$(CC) $(INCLUDES) -c $< -o $@
15
16 $(OBJECT_DIR)/%.c.o: %.c 
17         @mkdir -p $(@D)
18         @echo "  CC    $<"
19         @$(CC) $(INCLUDES) -c $< -o $@ $(CFLAGS)
20
21 $(BIN_DIR)/$(USR_LIB): $(OBJS)
22         @echo "  AR    $@"
23         @$(AR) rcs $@ $^
24
25 usr-runtime: $(BIN_DIR)/$(USR_LIB)
26
27 usr-runtime-debug: O := -Og
28 usr-runtime-debug: CFLAGS := -g -std=gnu99 -ffreestanding $(O) $(W) $(ARCH_OPT) -D__LUNAIXOS_DEBUG__
29 usr-runtime-debug: LDFLAGS := -g -ffreestanding $(O) -nostdlib -lgcc
30 usr-runtime-debug: usr-runtime
31
32 usr-objs: $(OBJS)