3 # NOTE: Does some voodoo to allow differing architecture builds to co-exist
4 # - The built objects and dependency files are suffixed with the arch name
5 # - The final binary is Acess2.<ARCH>.bin
7 -include ../Makefile.cfg
9 -include arch/$(ARCHDIR)/Makefile
11 -include Makefile.BuildNum.$(ARCH)
17 CPPFLAGS += -I./include -I./arch/$(ARCHDIR)/include -D_MODULE_NAME_=\"Kernel\"
18 CPPFLAGS += -DARCH=$(ARCH) -DARCHDIR=$(ARCHDIR) -DKERNEL_VERSION=$(KERNEL_VERSION) -DBUILD_NUM=$(BUILD_NUM)
19 CFLAGS += -Wall -Werror -O3 -fno-stack-protector -fno-builtin -Wstrict-prototypes -g
20 ASFLAGS += -D ARCH=\"$(ARCH)\" -D ARCHDIR=\"$(ARCHDIR)\"
21 LDFLAGS += -T arch/$(ARCHDIR)/link.ld -g
23 ifeq ($(DEBUG_BUILD),yes)
28 OBJ := $(addprefix arch/$(ARCHDIR)/,$(A_OBJ))
29 OBJ += heap.o drvutil.o logging.o debug.o lib.o adt.o time.o
30 OBJ += messages.o modules.o syscalls.o system.o threads.o
31 OBJ += $(addprefix vfs/fs/, $(addsuffix .o,$(FILESYSTEMS)))
32 OBJ += drv/kb.o drv/vterm.o drv/proc.o drv/fifo.o drv/iocache.o drv/dma.o drv/pci.o drv/vga.o
33 OBJ += binary.o bin/elf.o bin/pe.o
34 OBJ += vfs/main.o vfs/open.o vfs/acls.o vfs/dir.o vfs/io.o vfs/mount.o vfs/memfile.o vfs/nodecache.o vfs/handle.o
35 OBJ += vfs/fs/root.o vfs/fs/devfs.o
36 OBJ += $(addprefix drv/, $(addsuffix .o,$(DRIVERS)))
37 OBJ := $(addsuffix .$(ARCH), $(OBJ))
38 MODS += $(addprefix ../Modules/, $(addsuffix .xo.$(ARCH),$(MODULES)))
39 BIN = ../Acess2.$(ARCH).bin
40 GZBIN = ../Acess2.$(ARCH).gz
42 DEPFILES = $(filter %.o.$(ARCH),$(OBJ))
43 DEPFILES := $(DEPFILES:%.o.$(ARCH)=%.d.$(ARCH))
45 SRCFILES = $(OBJ:%.o.$(ARCH)=%.c)
46 SRCFILES := $(SRCFILES:%.ao.$(ARCH)=%.asm)
48 .PHONY: all clean install apidoc
53 @$(RM) $(BIN) ../Acess2.$(ARCH).gz $(BIN).dsm ../Map.$(ARCH).txt LineCounts.$(ARCH).txt $(OBJ) $(DEPFILES)
56 gzip -c $(BIN) > ../Acess2.$(ARCH).gz
57 $(xCP) ../Acess2.$(ARCH).gz $(DISTROOT)
62 $(BIN): $(OBJ) $(MODS) arch/$(ARCHDIR)/link.ld Makefile
63 @echo --- LD -o $(BIN)
64 @$(LD) $(LDFLAGS) -o $(BIN) $(OBJ) $(MODS) -Map ../Map.$(ARCH).txt
65 $(DISASM) -S $(BIN) > $(BIN).dsm
66 @wc -l $(SRCFILES) include/*.h > LineCounts.$(ARCH).txt
67 @echo BUILD_NUM = $$(( $(BUILD_NUM) + 1 )) > Makefile.BuildNum.$(ARCH)
71 %.ao.$(ARCH): %.asm Makefile
73 @$(AS) $(ASFLAGS) $< -o $@
75 %.o.$(ARCH): %.c Makefile
76 # if exists %*/Makefile
80 @$(CC) $(CFLAGS) $(CPPFLAGS) -o $@ -c $<
81 @$(MAKEDEP) $(CPPFLAGS) -MT $@ -o $*.d.$(ARCH) $<
87 include/syscalls.h: syscalls.lst Makefile
90 Makefile: ../Makefile.cfg arch/$(ARCHDIR)/Makefile
92 drv/proc.o.%: Makefile.BuildNum