4 -include ../../Makefile.Version.cfg
\r
5 -include Makefile.BuildNum
\r
14 KERNEL_SRC = ../../KernelLand/Kernel/
\r
15 LDACESS_SRC = ../../Usermode/Libraries/ld-acess.so_src/
\r
17 # - Kernel objects (from KernelLand/Kernel)
\r
18 KERNEL_OBJ := logging.o adt.o lib.o debug.o messages.o drvutil_disk.o drvutil_video.o memfs_helpers.o
\r
19 KERNEL_OBJ += mutex.o semaphore.o rwlock.o workqueue.o events.o
\r
20 #KERNEL_OBJ += libc.o
\r
21 KERNEL_OBJ += vfs/main.o vfs/open.o vfs/acls.o vfs/io.o vfs/dir.o
\r
22 KERNEL_OBJ += vfs/nodecache.o vfs/mount.o vfs/memfile.o vfs/select.o
\r
23 KERNEL_OBJ += vfs/fs/root.o vfs/fs/devfs.o
\r
24 KERNEL_OBJ += drv/fifo.o drv/proc.o drv/dgram_pipe.o
\r
25 KERNEL_OBJ += drv/vterm.o drv/vterm_font.o drv/vterm_output.o drv/vterm_input.o drv/vterm_termbuf.o
\r
26 KERNEL_OBJ += drv/vterm_vt100.o drv/vterm_2d.o
\r
27 KERNEL_OBJ += drv/pty.o
\r
28 # - Native (unsullied) objects
\r
29 N_OBJ := main.o net_wrap.o
\r
30 # - Local objects (use the kernel includes)
\r
31 OBJ := helpers.o threads.o threads_glue.o server.o syscalls.o time.o
\r
32 OBJ += video.o keyboard.o mouse.o nativefs.o vfs_handle.o ui_sdl.o
\r
33 OBJ += net.o syscall_getpath.o
\r
35 BUILDINFO_OBJ := obj-$(PLATFORM)/buildinfo.o
\r
36 BUILDINFO_SRC := $(BUILDINFO_OBJ:%.o=%.c)
\r
38 OBJ := $(addprefix obj-$(PLATFORM)/,$(OBJ))
\r
39 N_OBJ := $(addprefix obj-$(PLATFORM)/,$(N_OBJ))
\r
40 K_OBJ := $(addprefix $(KERNEL_SRC)obj-native-$(PLATFORM)/,$(KERNEL_OBJ))
\r
42 DEPFILES = $(filter %.o,$(OBJ) $(N_OBJ) $(K_OBJ))
\r
43 DEPFILES := $(DEPFILES:%=%.dep)
\r
45 KCPPFLAGS = -I include/ -I $(KERNEL_SRC)include/ -I$(LDACESS_SRC)include_exp/ -D KERNEL_VERSION=${ACESS_VERSION}
\r
46 CFLAGS += -Wall -g -std=gnu99
\r
47 CPPFLAGS += $(shell sdl-config --cflags) -I /usr/include/
\r
48 LDFLAGS += $(shell sdl-config --libs) -g -Wl,--defsym,__buildnum=$(BUILD_NUM)
\r
49 LDFLAGS += -Wl,-Map,obj-$(PLATFORM)/Map.txt
\r
51 ifeq ($(PLATFORM),win)
\r
52 BIN := ../AcessKernel.exe
\r
53 LDFLAGS += -lws2_32 -lpthread
\r
55 ifeq ($(PLATFORM),lin)
\r
56 BIN := ../AcessKernel
\r
58 LDFLAGS += -lpthread
\r
66 $(RM) $(BIN) $(OBJ) $(N_OBJ) $(K_OBJ) $(DEPFILES)
\r
68 $(BIN): $(OBJ) $(N_OBJ) $(K_OBJ) $(BUILDINFO_OBJ)
\r
70 @$(CC) -o $@ $(N_OBJ) $(LDFLAGS) $(K_OBJ) $(OBJ) $(BUILDINFO_OBJ)
\r
71 @echo BUILD_NUM = $$(( $(BUILD_NUM) + 1 )) > Makefile.BuildNum
\r
73 $(OBJ): obj-$(PLATFORM)/%.o: %.c
\r
78 $(K_OBJ): $(KERNEL_SRC)obj-native-$(PLATFORM)/%.o: $(KERNEL_SRC)%.c
\r
81 @$(CC) -ffreestanding -c $< -o $@ $(CFLAGS) $(KCPPFLAGS) $(CPPFLAGS) -MMD -MP -MF
[email protected]\r
84 $(N_OBJ): obj-$(PLATFORM)/%.o: %.c
\r
89 $(BUILDINFO_SRC): $(filter-out $(BUILDINFO_OBJ), $(OBJ)) Makefile
\r
91 $(eval _GITHASH=$(shell (git log -n 1 | head -n 1 | awk '{print $$2}') 2>/dev/null || echo UNK))
\r
92 $(eval _GITCHANGED=$(shell (git status --porcelain | grep -c '^ M ') 2>/dev/null || echo UNK))
\r
93 $(eval _HOSTNAME=$(shell hostname --fqdn 2>/dev/null || hostname || echo UNK))
\r
94 @echo "const char gsKernelVersion[] = \"$(ACESS_VERSION)\";" >> $@
\r
95 @echo "const char gsGitHash[] = \"$(_GITHASH)\";" >> $@
\r
96 @echo "const char gsBuildInfo[] = \"AcessNative $(ACESS_VERSION) $(ARCH)-$(PLATFORM)\\\\r\\\\n\"" >> $@
\r
97 @echo " \"Build $(_HOSTNAME):$(BUILD_NUM) Git $(_GITHASH) - $(_GITCHANGED) modified\";" >> $@
\r
98 @echo "const int giBuildNumber = $(BUILD_NUM);" >> $@
\r
99 $(BUILDINFO_OBJ): $(BUILDINFO_SRC)
\r
101 @$(CC) -o $@ -c $< $(CFLAGS) $(CPPFLAGS)
\r
103 -include $(DEPFILES)
\r