2021-12-12 23:07:42 +01:00
|
|
|
ifndef KOLIBRIOS
|
|
|
|
$(error "Set KOLIBRIOS environment variable to KolibriOS root")
|
|
|
|
endif
|
|
|
|
|
2021-12-13 13:58:19 +01:00
|
|
|
FASM_EXE ?= fasm
|
2021-12-13 15:04:42 +01:00
|
|
|
FASM_FLAGS=-dUEFI=1 -dextended_primary_loader=1 -dUMKA=1 -dHOST=$(HOST) -m 2000000
|
2021-12-13 13:58:19 +01:00
|
|
|
|
2023-01-04 01:15:40 +01:00
|
|
|
HOST ?= linux
|
2021-12-12 23:07:42 +01:00
|
|
|
CC ?= gcc
|
|
|
|
WARNINGS_COMMON=-Wall -Wextra \
|
|
|
|
-Wnull-dereference -Wshadow -Wformat=2 -Wswitch -Wswitch-enum \
|
2023-02-05 08:32:43 +01:00
|
|
|
-Wpedantic -Wstrict-prototypes -Wunused -Wformat-nonliteral \
|
2020-09-17 18:44:57 +02:00
|
|
|
#-Wconversion -Wsign-conversion
|
2021-12-13 13:58:19 +01:00
|
|
|
NOWARNINGS_COMMON=-Wno-address-of-packed-member
|
2021-12-12 23:07:42 +01:00
|
|
|
|
2023-02-10 23:33:22 +01:00
|
|
|
CFLAGS_ISOCLINE_COMMON=-D__MINGW_USE_VC2005_COMPAT
|
|
|
|
ifeq (,$(findstring gcc,$(CC)))
|
2021-12-12 23:07:42 +01:00
|
|
|
WARNINGS=$(WARNINGS_COMMON)
|
2021-12-13 13:58:19 +01:00
|
|
|
NOWARNINGS=$(NOWARNINGS_COMMON) -Wno-missing-prototype-for-cc
|
2023-02-10 23:33:22 +01:00
|
|
|
CFLAGS_ISOCLINE=$(CFLAGS_ISOCLINE_COMMON) -Wno-format-nonliteral
|
|
|
|
else ifeq (,$(findstring clang,$(CC)))
|
|
|
|
WARNINGS=$(WARNINGS_COMMON) -Wduplicated-cond -Wduplicated-branches \
|
|
|
|
-Wrestrict -Wlogical-op -Wjump-misses-init
|
|
|
|
NOWARNINGS=$(NOWARNINGS_COMMON)
|
|
|
|
CFLAGS_ISOCLINE=$(CFLAGS_ISOCLINE_COMMON) -Wno-duplicated-branches
|
2021-12-12 23:07:42 +01:00
|
|
|
else
|
2021-12-13 13:58:19 +01:00
|
|
|
$(error your compiler is not supported)
|
2021-12-12 23:07:42 +01:00
|
|
|
endif
|
|
|
|
|
2023-01-16 04:14:48 +01:00
|
|
|
CFLAGS=$(WARNINGS) $(NOWARNINGS) -std=c11 -g -O0 -DNDEBUG -masm=intel \
|
2023-02-05 00:41:26 +01:00
|
|
|
-D_POSIX_C_SOURCE=200809L -I$(HOST) -Ideps -I. -fno-pie -D_POSIX
|
2023-01-16 04:14:48 +01:00
|
|
|
CFLAGS_32=$(CFLAGS) -m32 -D_FILE_OFFSET_BITS=64 -D__USE_TIME_BITS64
|
2020-10-10 03:03:30 +02:00
|
|
|
LDFLAGS=-no-pie
|
2020-02-21 03:21:09 +01:00
|
|
|
LDFLAGS_32=$(LDFLAGS) -m32
|
2023-02-20 04:07:54 +01:00
|
|
|
LIBS_COMMON=-lpthread
|
2017-10-18 02:08:32 +02:00
|
|
|
|
2023-02-20 04:07:54 +01:00
|
|
|
ifeq ($(HOST),linux)
|
|
|
|
LIBS=$(LIBS_COMMON)
|
|
|
|
else ifeq ($(HOST),windows)
|
|
|
|
LIBS=$(LIBS_COMMON) -lws2_32
|
|
|
|
else
|
|
|
|
$(error your HOST is not supported)
|
2023-02-06 17:01:37 +01:00
|
|
|
endif
|
|
|
|
|
2023-02-03 03:35:26 +01:00
|
|
|
ifeq ($(HOST),linux)
|
2021-12-13 13:58:19 +01:00
|
|
|
FASM_INCLUDE=$(KOLIBRIOS)/kernel/trunk;$(KOLIBRIOS)/programs/develop/libraries/libcrash/hash
|
|
|
|
FASM=INCLUDE="$(FASM_INCLUDE)" $(FASM_EXE) $(FASM_FLAGS)
|
2023-02-03 03:35:26 +01:00
|
|
|
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
|
2023-02-20 04:07:54 +01:00
|
|
|
$(error your HOST is not supported)
|
2023-02-03 03:35:26 +01:00
|
|
|
endif
|
2021-12-13 13:58:19 +01:00
|
|
|
|
|
|
|
ifeq ($(HOST),linux)
|
2023-01-28 03:57:08 +01:00
|
|
|
all: umka_shell umka_fuse umka_os umka_gen_devices_dat umka.sym umka.prp \
|
2023-09-01 23:57:11 +02:00
|
|
|
umka.lst tags default.skn skin.skn runtests
|
2021-12-13 13:58:19 +01:00
|
|
|
else ifeq ($(HOST),windows)
|
2023-09-01 23:57:11 +02:00
|
|
|
all: umka_shell umka.sym umka.prp umka.lst default.skn skin.skn runtests
|
2021-12-13 13:58:19 +01:00
|
|
|
else
|
2023-02-20 04:07:54 +01:00
|
|
|
$(error your HOST is not supported)
|
2021-12-13 13:58:19 +01:00
|
|
|
endif
|
2020-01-29 11:53:13 +01:00
|
|
|
|
2021-12-12 11:35:35 +01:00
|
|
|
.PHONY: test
|
|
|
|
|
2021-12-12 11:48:42 +01:00
|
|
|
test: umka_shell
|
|
|
|
@cd test && make clean all && cd ../
|
|
|
|
|
2023-01-04 01:15:40 +01:00
|
|
|
umka_shell: umka_shell.o umka.o shell.o trace.o trace_lbr.o vdisk.o \
|
2023-02-05 00:41:26 +01:00
|
|
|
vdisk/raw.o vdisk/qcow2.o deps/em_inflate/em_inflate.o vnet.o \
|
2023-02-14 14:57:38 +01:00
|
|
|
$(HOST)/vnet/tap.o vnet/file.o vnet/null.o deps/lodepng/lodepng.o \
|
|
|
|
$(HOST)/pci.o $(HOST)/thread.o umkaio.o umkart.o \
|
|
|
|
deps/optparse/optparse.o deps/isocline/src/isocline.o
|
2023-02-06 17:01:37 +01:00
|
|
|
$(CC) $(LDFLAGS_32) $^ -o $@ -T umka.ld $(LIBS)
|
2017-10-18 02:08:32 +02:00
|
|
|
|
2023-01-04 01:15:40 +01:00
|
|
|
umka_fuse: umka_fuse.o umka.o trace.o trace_lbr.o vdisk.o vdisk/raw.o \
|
2023-02-05 00:41:26 +01:00
|
|
|
vdisk/qcow2.o deps/em_inflate/em_inflate.o $(HOST)/pci.o \
|
|
|
|
$(HOST)/thread.o umkaio.o
|
2020-10-22 01:44:34 +02:00
|
|
|
$(CC) $(LDFLAGS_32) $^ -o $@ `pkg-config fuse3 --libs` -T umka.ld
|
2017-10-18 22:19:53 +02:00
|
|
|
|
2023-02-14 14:57:38 +01:00
|
|
|
umka_os: umka_os.o umka.o shell.o deps/lodepng/lodepng.o vdisk.o vdisk/raw.o \
|
|
|
|
vdisk/qcow2.o deps/em_inflate/em_inflate.o vnet.o $(HOST)/vnet/tap.o \
|
|
|
|
vnet/file.o vnet/null.o trace.o trace_lbr.o $(HOST)/pci.o \
|
|
|
|
$(HOST)/thread.o umkaio.o umkart.o deps/isocline/src/isocline.o \
|
|
|
|
deps/optparse/optparse.o
|
2023-01-30 07:24:23 +01:00
|
|
|
$(CC) $(LDFLAGS_32) `sdl2-config --libs` $^ -o $@ -T umka.ld
|
2023-01-21 08:49:13 +01:00
|
|
|
|
2023-01-04 01:15:40 +01:00
|
|
|
umka_gen_devices_dat: umka_gen_devices_dat.o umka.o $(HOST)/pci.o \
|
2023-01-31 03:38:48 +01:00
|
|
|
$(HOST)/thread.o umkart.o
|
2021-12-12 23:07:42 +01:00
|
|
|
$(CC) $(LDFLAGS_32) $^ -o $@ -T umka.ld
|
2021-11-03 15:28:03 +01:00
|
|
|
|
2020-03-08 03:02:53 +01:00
|
|
|
umka.o umka.fas: umka.asm
|
2021-12-13 13:58:19 +01:00
|
|
|
$(FASM) $< umka.o -s umka.fas
|
2020-02-04 22:53:24 +01:00
|
|
|
|
2023-02-14 14:57:38 +01:00
|
|
|
shell.o: shell.c deps/lodepng/lodepng.h
|
2020-05-10 06:21:49 +02:00
|
|
|
$(CC) $(CFLAGS_32) -c $<
|
|
|
|
|
2023-02-01 19:30:44 +01:00
|
|
|
umkaio.o: umkaio.c umkaio.h
|
2023-01-18 09:29:08 +01:00
|
|
|
$(CC) $(CFLAGS_32) -D_DEFAULT_SOURCE -c $< -o $@
|
|
|
|
|
2023-01-04 01:15:40 +01:00
|
|
|
$(HOST)/thread.o: $(HOST)/thread.c
|
|
|
|
$(CC) $(CFLAGS_32) -c $< -o $@
|
2020-05-09 04:15:57 +02:00
|
|
|
|
2023-01-04 01:15:40 +01:00
|
|
|
$(HOST)/pci.o: $(HOST)/pci.c
|
|
|
|
$(CC) $(CFLAGS_32) -std=gnu11 -c $< -o $@
|
2020-05-02 00:09:42 +02:00
|
|
|
|
2023-02-14 14:57:38 +01:00
|
|
|
deps/lodepng/lodepng.o: deps/lodepng/lodepng.c deps/lodepng/lodepng.h
|
2023-02-16 20:32:37 +01:00
|
|
|
$(CC) $(CFLAGS_32) -c $< -o $@ -DLODEPNG_NO_COMPILE_DECODER \
|
2023-02-17 03:04:54 +01:00
|
|
|
-DLODEPNG_NO_COMPILE_ANCILLARY_CHUNKS
|
2020-02-19 01:27:18 +01:00
|
|
|
|
2023-02-05 08:32:43 +01:00
|
|
|
deps/isocline/src/isocline.o: deps/isocline/src/isocline.c \
|
|
|
|
deps/isocline/include/isocline.h
|
2023-02-10 23:33:22 +01:00
|
|
|
$(CC) $(CFLAGS_32) $(CFLAGS_ISOCLINE) -c $< -o $@ -Wno-shadow \
|
2023-02-05 08:32:43 +01:00
|
|
|
-Wno-unused-function
|
2022-05-24 21:22:12 +02:00
|
|
|
|
2023-02-05 00:41:26 +01:00
|
|
|
deps/optparse/optparse.o: deps/optparse/optparse.c deps/optparse/optparse.h
|
2023-02-05 08:32:43 +01:00
|
|
|
$(CC) $(CFLAGS_32) -c $< -o $@
|
2021-12-12 11:35:35 +01:00
|
|
|
|
2023-01-31 03:38:48 +01:00
|
|
|
umkart.o: umkart.c umkart.h umka.h
|
2021-11-17 02:07:38 +01:00
|
|
|
$(CC) $(CFLAGS_32) -c $<
|
|
|
|
|
2022-02-09 02:27:49 +01:00
|
|
|
default.skn: $(KOLIBRIOS)/skins/Leency/Shkvorka/default.asm colors.dtp
|
|
|
|
$(FASM) $< $@
|
|
|
|
|
|
|
|
colors.dtp: $(KOLIBRIOS)/skins/Leency/Shkvorka/colors.dtp.asm
|
|
|
|
$(FASM) $< $@
|
2020-03-08 03:02:53 +01:00
|
|
|
|
2021-04-02 03:22:22 +02:00
|
|
|
skin.skn: $(KOLIBRIOS)/skins/Leency/Octo_flat/default.asm
|
2021-12-15 20:31:03 +01:00
|
|
|
$(FASM) "$<" $@
|
2019-10-09 01:35:47 +02:00
|
|
|
|
2020-02-17 03:43:33 +01:00
|
|
|
umka.prp: umka.fas
|
|
|
|
prepsrc $< $@
|
2019-10-30 22:54:12 +01:00
|
|
|
|
2020-02-17 03:43:33 +01:00
|
|
|
umka.sym: umka.fas
|
|
|
|
symbols $< $@
|
2019-10-09 01:35:47 +02:00
|
|
|
|
2020-02-17 03:43:33 +01:00
|
|
|
umka.lst: umka.fas
|
|
|
|
listing $< $@
|
2019-10-09 01:35:47 +02:00
|
|
|
|
2020-02-17 03:43:33 +01:00
|
|
|
tags: umka.sym
|
2019-10-31 21:26:53 +01:00
|
|
|
fasmtags.py $<
|
|
|
|
|
2019-10-09 01:35:47 +02:00
|
|
|
trace.o: trace.c trace.h trace_lbr.h
|
2020-02-21 03:21:09 +01:00
|
|
|
$(CC) $(CFLAGS_32) -c $<
|
2019-10-09 01:35:47 +02:00
|
|
|
|
2020-05-07 03:57:01 +02:00
|
|
|
trace_lbr.o: trace_lbr.c trace_lbr.h umka.h
|
2020-02-21 03:21:09 +01:00
|
|
|
$(CC) $(CFLAGS_32) -c $<
|
2019-10-09 01:35:47 +02:00
|
|
|
|
2023-01-04 01:15:40 +01:00
|
|
|
vdisk.o: vdisk.c vdisk/raw.h vdisk/qcow2.h
|
2020-02-21 03:21:09 +01:00
|
|
|
$(CC) $(CFLAGS_32) -c $<
|
2017-10-18 02:08:32 +02:00
|
|
|
|
2023-01-04 01:15:40 +01:00
|
|
|
vdisk/raw.o: vdisk/raw.c vdisk/raw.h
|
|
|
|
$(CC) $(CFLAGS_32) -c $< -o $@
|
|
|
|
|
|
|
|
vdisk/qcow2.o: vdisk/qcow2.c vdisk/qcow2.h
|
|
|
|
$(CC) $(CFLAGS_32) -c $< -o $@
|
|
|
|
|
2023-02-05 00:41:26 +01:00
|
|
|
deps/em_inflate/em_inflate.o: deps/em_inflate/em_inflate.c deps/em_inflate/em_inflate.h
|
|
|
|
$(CC) $(CFLAGS_32) -c $< -o $@ -Wno-sign-compare -Wno-unused-parameter \
|
|
|
|
-Wno-switch-enum -Wno-unused-function
|
2023-01-04 01:15:40 +01:00
|
|
|
|
2023-02-01 19:30:44 +01:00
|
|
|
vnet.o: vnet.c vnet.h
|
2020-05-06 23:33:32 +02:00
|
|
|
$(CC) $(CFLAGS_32) -c $<
|
|
|
|
|
2023-02-01 19:30:44 +01:00
|
|
|
$(HOST)/vnet/tap.o: $(HOST)/vnet/tap.c vnet/tap.h
|
|
|
|
$(CC) $(CFLAGS_32) -c $< -o $@
|
|
|
|
|
|
|
|
vnet/file.o: vnet/file.c vnet/file.h
|
|
|
|
$(CC) $(CFLAGS_32) -c $< -o $@
|
|
|
|
|
2023-02-06 17:01:37 +01:00
|
|
|
vnet/null.o: vnet/null.c vnet/null.h
|
|
|
|
$(CC) $(CFLAGS_32) -c $< -o $@
|
|
|
|
|
2020-05-07 03:57:01 +02:00
|
|
|
umka_shell.o: umka_shell.c umka.h trace.h
|
2020-03-09 22:03:57 +01:00
|
|
|
$(CC) $(CFLAGS_32) -c $<
|
2019-10-13 03:17:29 +02:00
|
|
|
|
2020-05-07 03:57:01 +02:00
|
|
|
umka_fuse.o: umka_fuse.c umka.h
|
2020-03-09 22:03:57 +01:00
|
|
|
$(CC) $(CFLAGS_32) `pkg-config fuse3 --cflags` -c $<
|
2018-05-09 23:08:52 +02:00
|
|
|
|
2023-01-31 03:38:48 +01:00
|
|
|
umka_os.o: umka_os.c umka.h
|
2023-01-28 03:57:08 +01:00
|
|
|
$(CC) $(CFLAGS_32) `sdl2-config --cflags` -c $<
|
2020-05-08 06:44:32 +02:00
|
|
|
|
2021-11-03 15:28:03 +01:00
|
|
|
umka_gen_devices_dat.o: umka_gen_devices_dat.c umka.h
|
|
|
|
$(CC) $(CFLAGS_32) -c $<
|
|
|
|
|
2023-09-01 23:57:11 +02:00
|
|
|
runtests: runtests.o deps/optparse/optparse.o
|
2023-02-20 04:07:54 +01:00
|
|
|
$(CC) $(LDFLAGS_32) -o $@ $^ $(LIBS)
|
2023-02-16 20:32:37 +01:00
|
|
|
|
2023-09-01 23:57:11 +02:00
|
|
|
runtests.o: runtests.c
|
2023-02-16 20:32:37 +01:00
|
|
|
$(CC) $(CFLAGS_32) -c $< -o $@ -Wno-deprecated-declarations
|
|
|
|
|
|
|
|
|
2017-10-18 22:19:53 +02:00
|
|
|
.PHONY: all clean
|
2017-10-18 02:08:32 +02:00
|
|
|
|
|
|
|
clean:
|
2023-01-04 01:15:40 +01:00
|
|
|
rm -f umka_shell umka_fuse umka_os umka_gen_devices_dat umka.fas \
|
2023-02-16 20:32:37 +01:00
|
|
|
umka.sym umka.lst umka.prp umka.cov coverage *.skn colors.dtp \
|
2023-09-01 23:57:11 +02:00
|
|
|
runtests
|
2023-01-04 01:15:40 +01:00
|
|
|
find . -name "*.o" -delete
|
|
|
|
find . -name "*.a" -delete
|