2021-12-13 01:07:42 +03:00
|
|
|
ifndef KOLIBRIOS
|
|
|
|
$(error "Set KOLIBRIOS environment variable to KolibriOS root")
|
|
|
|
endif
|
|
|
|
|
2021-12-13 15:58:19 +03:00
|
|
|
ifndef HOST
|
|
|
|
$(error "Set HOST variable to linux/windows")
|
|
|
|
endif
|
|
|
|
|
|
|
|
FASM_EXE ?= fasm
|
|
|
|
FASM_INCLUDE=$(KOLIBRIOS)/kernel/trunk;$(KOLIBRIOS)/programs/develop/libraries/libcrash/hash
|
|
|
|
FASM_FLAGS=-dUEFI=1 -dextended_primary_loader=1 -dUMKA=1 -dHOST=$(HOST)
|
|
|
|
|
2021-12-13 01:07:42 +03:00
|
|
|
CC ?= gcc
|
|
|
|
WARNINGS_COMMON=-Wall -Wextra \
|
|
|
|
-Wnull-dereference -Wshadow -Wformat=2 -Wswitch -Wswitch-enum \
|
|
|
|
-Wpedantic \
|
2020-09-17 19:44:57 +03:00
|
|
|
#-Wconversion -Wsign-conversion
|
2021-12-13 15:58:19 +03:00
|
|
|
NOWARNINGS_COMMON=-Wno-address-of-packed-member
|
2021-12-13 01:07:42 +03:00
|
|
|
|
2021-12-13 15:58:19 +03:00
|
|
|
ifneq (,$(findstring gcc,$(CC)))
|
2021-12-13 01:07:42 +03:00
|
|
|
WARNINGS=$(WARNINGS_COMMON) -Wduplicated-cond -Wduplicated-branches -Wrestrict -Wlogical-op -Wjump-misses-init
|
|
|
|
NOWARNINGS=$(NOWARNINGS_COMMON)
|
2021-12-13 15:58:19 +03:00
|
|
|
else ifneq (,$(findstring clang,$(CC)))
|
2021-12-13 01:07:42 +03:00
|
|
|
WARNINGS=$(WARNINGS_COMMON)
|
2021-12-13 15:58:19 +03:00
|
|
|
NOWARNINGS=$(NOWARNINGS_COMMON) -Wno-missing-prototype-for-cc
|
2021-12-13 01:07:42 +03:00
|
|
|
else
|
2021-12-13 15:58:19 +03:00
|
|
|
$(error your compiler is not supported)
|
2021-12-13 01:07:42 +03:00
|
|
|
endif
|
|
|
|
|
2020-10-10 04:03:30 +03:00
|
|
|
CFLAGS=$(WARNINGS) $(NOWARNINGS) -std=c11 -g -O0 -D_FILE_OFFSET_BITS=64 \
|
2021-12-13 15:58:19 +03:00
|
|
|
-DNDEBUG -masm=intel -D_POSIX_C_SOURCE=200809L -I$(HOST) -fno-pie
|
2020-02-19 03:27:18 +03:00
|
|
|
CFLAGS_32=$(CFLAGS) -m32
|
2020-10-10 04:03:30 +03:00
|
|
|
LDFLAGS=-no-pie
|
2020-02-21 05:21:09 +03:00
|
|
|
LDFLAGS_32=$(LDFLAGS) -m32
|
2017-10-18 03:08:32 +03:00
|
|
|
|
2021-12-13 15:58:19 +03:00
|
|
|
ifeq ($(HOST),linux)
|
|
|
|
FASM_INCLUDE=$(KOLIBRIOS)/kernel/trunk;$(KOLIBRIOS)/programs/develop/libraries/libcrash/hash
|
|
|
|
FASM=INCLUDE="$(FASM_INCLUDE)" $(FASM_EXE) $(FASM_FLAGS)
|
|
|
|
else ifeq ($(HOST),windows)
|
|
|
|
FASM_INCLUDE=$(KOLIBRIOS)\kernel\trunk;$(KOLIBRIOS)\programs\develop\libraries\libcrash\hash
|
|
|
|
FASM=set INCLUDE=$(FASM_INCLUDE)&&$(FASM_EXE) $(FASM_FLAGS)
|
|
|
|
else
|
|
|
|
$(error your OS is not supported)
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(HOST),linux)
|
2021-11-03 17:28:03 +03:00
|
|
|
all: umka_shell umka_fuse umka_os umka_gen_devices_dat umka.sym umka.prp \
|
|
|
|
umka.lst tags covpreproc default.skn skin.skn
|
2021-12-13 15:58:19 +03:00
|
|
|
else ifeq ($(HOST),windows)
|
|
|
|
all: umka_shell umka.sym umka.prp \
|
|
|
|
umka.lst default.skn skin.skn
|
|
|
|
else
|
|
|
|
$(error your OS is not supported)
|
|
|
|
endif
|
2020-01-29 13:53:13 +03:00
|
|
|
|
2021-12-12 13:35:35 +03:00
|
|
|
.PHONY: test
|
|
|
|
|
2021-12-12 13:48:42 +03:00
|
|
|
test: umka_shell
|
|
|
|
@cd test && make clean all && cd ../
|
|
|
|
|
2020-01-29 13:53:13 +03:00
|
|
|
covpreproc: covpreproc.c
|
|
|
|
$(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@
|
2017-10-18 03:08:32 +03:00
|
|
|
|
2020-09-17 19:44:57 +03:00
|
|
|
umka_shell: umka_shell.o umka.o shell.o trace.o trace_lbr.o vdisk.o vnet.o \
|
2021-12-13 15:58:19 +03:00
|
|
|
lodepng.o pci.o thread.o util.o getopt.o
|
2021-12-13 01:07:42 +03:00
|
|
|
$(CC) $(LDFLAGS_32) $^ -o $@ -T umka.ld
|
2017-10-18 03:08:32 +03:00
|
|
|
|
2020-05-09 05:15:57 +03:00
|
|
|
umka_fuse: umka_fuse.o umka.o trace.o trace_lbr.o vdisk.o pci.o thread.o
|
2020-10-22 02:44:34 +03:00
|
|
|
$(CC) $(LDFLAGS_32) $^ -o $@ `pkg-config fuse3 --libs` -T umka.ld
|
2017-10-18 23:19:53 +03:00
|
|
|
|
2020-09-17 19:44:57 +03:00
|
|
|
umka_os: umka_os.o umka.o shell.o lodepng.o vdisk.o vnet.o trace.o trace_lbr.o \
|
2021-11-17 04:07:38 +03:00
|
|
|
pci.o thread.o umka_ping.o util.o
|
2021-12-13 01:07:42 +03:00
|
|
|
$(CC) $(LDFLAGS_32) $^ -o $@ -T umka.ld
|
2020-05-08 07:44:32 +03:00
|
|
|
|
2021-11-17 04:07:38 +03:00
|
|
|
umka_gen_devices_dat: umka_gen_devices_dat.o umka.o pci.o thread.o util.o
|
2021-12-13 01:07:42 +03:00
|
|
|
$(CC) $(LDFLAGS_32) $^ -o $@ -T umka.ld
|
2021-11-03 17:28:03 +03:00
|
|
|
|
2020-03-08 05:02:53 +03:00
|
|
|
umka.o umka.fas: umka.asm
|
2021-12-13 15:58:19 +03:00
|
|
|
$(FASM) $< umka.o -s umka.fas
|
2020-02-05 00:53:24 +03:00
|
|
|
|
2020-05-10 07:21:49 +03:00
|
|
|
shell.o: shell.c
|
|
|
|
$(CC) $(CFLAGS_32) -c $<
|
|
|
|
|
2021-12-13 15:58:19 +03:00
|
|
|
thread.o: $(HOST)/thread.c
|
2020-05-09 05:15:57 +03:00
|
|
|
$(CC) $(CFLAGS_32) -c $<
|
|
|
|
|
2021-12-13 15:58:19 +03:00
|
|
|
pci.o: $(HOST)/pci.c
|
|
|
|
$(CC) $(CFLAGS_32) -std=gnu11 -c $<
|
2020-05-02 01:09:42 +03:00
|
|
|
|
2020-02-19 03:27:18 +03:00
|
|
|
lodepng.o: lodepng.c lodepng.h
|
|
|
|
$(CC) $(CFLAGS_32) -c $<
|
|
|
|
|
2021-12-12 13:35:35 +03:00
|
|
|
getopt.o: getopt.c getopt.h
|
|
|
|
$(CC) $(CFLAGS_32) -c $<
|
|
|
|
|
2021-11-17 04:07:38 +03:00
|
|
|
util.o: util.c util.h umka.h
|
|
|
|
$(CC) $(CFLAGS_32) -c $<
|
|
|
|
|
2021-04-02 04:22:22 +03:00
|
|
|
default.skn: $(KOLIBRIOS)/skins/Leency/Shkvorka/default.asm
|
2020-03-08 05:02:53 +03:00
|
|
|
$(FASM) $< $@
|
|
|
|
|
2021-04-02 04:22:22 +03:00
|
|
|
skin.skn: $(KOLIBRIOS)/skins/Leency/Octo_flat/default.asm
|
2020-02-05 00:53:24 +03:00
|
|
|
$(FASM) $< $@
|
2019-10-09 02:35:47 +03:00
|
|
|
|
2020-02-17 05:43:33 +03:00
|
|
|
umka.prp: umka.fas
|
|
|
|
prepsrc $< $@
|
2019-10-31 00:54:12 +03:00
|
|
|
|
2020-02-17 05:43:33 +03:00
|
|
|
umka.sym: umka.fas
|
|
|
|
symbols $< $@
|
2019-10-09 02:35:47 +03:00
|
|
|
|
2020-02-17 05:43:33 +03:00
|
|
|
umka.lst: umka.fas
|
|
|
|
listing $< $@
|
2019-10-09 02:35:47 +03:00
|
|
|
|
2020-02-17 05:43:33 +03:00
|
|
|
tags: umka.sym
|
2019-10-31 23:26:53 +03:00
|
|
|
fasmtags.py $<
|
|
|
|
|
2019-10-09 02:35:47 +03:00
|
|
|
trace.o: trace.c trace.h trace_lbr.h
|
2020-02-21 05:21:09 +03:00
|
|
|
$(CC) $(CFLAGS_32) -c $<
|
2019-10-09 02:35:47 +03:00
|
|
|
|
2020-05-07 04:57:01 +03:00
|
|
|
trace_lbr.o: trace_lbr.c trace_lbr.h umka.h
|
2020-02-21 05:21:09 +03:00
|
|
|
$(CC) $(CFLAGS_32) -c $<
|
2019-10-09 02:35:47 +03:00
|
|
|
|
2020-02-20 06:41:53 +03:00
|
|
|
vdisk.o: vdisk.c
|
2020-02-21 05:21:09 +03:00
|
|
|
$(CC) $(CFLAGS_32) -c $<
|
2017-10-18 03:08:32 +03:00
|
|
|
|
2020-05-07 00:33:32 +03:00
|
|
|
vnet.o: vnet.c
|
|
|
|
$(CC) $(CFLAGS_32) -c $<
|
|
|
|
|
2020-05-07 04:57:01 +03:00
|
|
|
umka_shell.o: umka_shell.c umka.h trace.h
|
2020-03-10 00:03:57 +03:00
|
|
|
$(CC) $(CFLAGS_32) -c $<
|
2019-10-13 04:17:29 +03:00
|
|
|
|
2020-05-07 04:57:01 +03:00
|
|
|
umka_fuse.o: umka_fuse.c umka.h
|
2020-03-10 00:03:57 +03:00
|
|
|
$(CC) $(CFLAGS_32) `pkg-config fuse3 --cflags` -c $<
|
2018-05-10 00:08:52 +03:00
|
|
|
|
2020-05-08 07:44:32 +03:00
|
|
|
umka_os.o: umka_os.c umka.h
|
2020-10-17 05:13:18 +03:00
|
|
|
$(CC) $(CFLAGS_32) -c $< -D_XOPEN_SOURCE=600
|
2020-05-08 07:44:32 +03:00
|
|
|
|
2021-11-03 17:28:03 +03:00
|
|
|
umka_gen_devices_dat.o: umka_gen_devices_dat.c umka.h
|
|
|
|
$(CC) $(CFLAGS_32) -c $<
|
|
|
|
|
2020-10-10 02:30:52 +03:00
|
|
|
umka_ping.o: umka_ping.c umka.h
|
|
|
|
$(CC) $(CFLAGS_32) -D_DEFAULT_SOURCE -c $<
|
|
|
|
|
2017-10-18 23:19:53 +03:00
|
|
|
.PHONY: all clean
|
2017-10-18 03:08:32 +03:00
|
|
|
|
|
|
|
clean:
|
2021-11-03 17:28:03 +03:00
|
|
|
rm -f *.o umka_shell umka_fuse umka_os umka_gen_devices_dat umka.fas \
|
|
|
|
umka.sym umka.lst umka.prp coverage
|