2 TARGET := $(shell gcc -v 2>&1 | grep Targ | awk '{print $$2}')
4 KERNEL_SRC = ../../../KernelLand/Kernel/
7 # Kernel Sources (compiled with -ffreestanding)
8 K_OBJ = vfs/main.o vfs/open.o vfs/acls.o vfs/io.o vfs/dir.o
9 K_OBJ += vfs/nodecache.o vfs/mount.o vfs/memfile.o vfs/select.o
10 K_OBJ += vfs/fs/root.o vfs/fs/devfs.o
12 # Local kernel soruces (same as above, but located in same directory as Makefile)
13 L_OBJ = vfs_handles.o threads.o nativefs.o
14 # Native Sources (compiled as usual)
15 N_OBJ = main.o script.o logging.o
19 CPPFLAGS := -I include/
20 K_CPPFLAGS := -I $(KERNEL_SRC)include
22 # == Start of Magic ==
23 OBJ_PREFIX = obj/$(TARGET)/
24 K_OBJ_PREFIX = $(OBJ_PREFIX)_Kernel/
25 K_OBJ := $(addprefix $(K_OBJ_PREFIX),$(K_OBJ))
26 L_OBJ := $(addprefix $(OBJ_PREFIX),$(L_OBJ))
27 N_OBJ := $(addprefix $(OBJ_PREFIX),$(N_OBJ))
29 OBJ := $(N_OBJ) $(L_OBJ) $(K_OBJ)
31 DEPFILES = $(filter %.o,$(OBJ))
32 DEPFILES := $(DEPFILES:%=%.dep)
40 $(RM) -f $(OBJ) $(DEPFILES) $(BIN)
43 $(CC) -o $(BIN) $(OBJ) $(LDFLAGS)
45 $(K_OBJ): $(K_OBJ_PREFIX)%.o: $(KERNEL_SRC)%.c
47 $(CC) -c $< -o $@ -ffreestanding $(CFLAGS) $(CPPFLAGS) $(K_CPPFLAGS) -MMD -MP -MF
[email protected]
49 $(L_OBJ): $(OBJ_PREFIX)%.o: %.c
51 $(CC) -c $< -o $@ -ffreestanding $(CFLAGS) $(CPPFLAGS) $(K_CPPFLAGS) -MMD -MP -MF
[email protected]
53 $(N_OBJ): $(OBJ_PREFIX)%.o: %.c