2011-10-28 03:19:39 +04:00
|
|
|
# ToAruOS Primary Build Script
|
2014-05-08 02:26:26 +04:00
|
|
|
ifneq ($(MAKECMDGOALS),toolchain)
|
|
|
|
ifeq ($(TOOLCHAIN),)
|
|
|
|
$(error No toolchain available and you did not ask to build it. Did you forget to source the toolchain config?)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2014-03-09 10:17:47 +04:00
|
|
|
|
|
|
|
# We always build with our targetted cross-compiler
|
2013-06-07 08:59:20 +04:00
|
|
|
CC = i686-pc-toaru-gcc
|
2014-03-11 12:43:42 +04:00
|
|
|
NM = i686-pc-toaru-nm
|
2014-05-03 09:38:39 +04:00
|
|
|
CXX= i686-pc-toaru-g++
|
2014-09-13 09:01:24 +04:00
|
|
|
AR = i686-pc-toaru-ar
|
2015-05-20 10:12:20 +03:00
|
|
|
AS = i686-pc-toaru-as
|
2014-03-11 12:43:42 +04:00
|
|
|
|
2014-03-09 10:17:47 +04:00
|
|
|
# Build flags
|
2014-03-17 00:53:19 +04:00
|
|
|
CFLAGS = -O2 -std=c99
|
2014-03-09 10:17:47 +04:00
|
|
|
CFLAGS += -finline-functions -ffreestanding
|
2015-05-04 04:35:40 +03:00
|
|
|
CFLAGS += -Wall -Wextra -Wno-unused-function -Wno-unused-parameter -Wno-format
|
2014-05-03 05:34:07 +04:00
|
|
|
CFLAGS += -pedantic -fno-omit-frame-pointer
|
2014-03-25 07:18:40 +04:00
|
|
|
CFLAGS += -D_KERNEL_
|
2014-03-09 10:17:47 +04:00
|
|
|
|
2015-05-20 10:12:20 +03:00
|
|
|
ASFLAGS = --32
|
|
|
|
|
2014-04-27 09:17:30 +04:00
|
|
|
# Kernel autoversioning with git sha
|
|
|
|
CFLAGS += -DKERNEL_GIT_TAG=`util/make-version`
|
|
|
|
|
2014-03-09 10:17:47 +04:00
|
|
|
# We have some pieces of assembly sitting around as well...
|
2011-02-21 05:15:39 +03:00
|
|
|
YASM = yasm
|
2014-03-09 09:46:43 +04:00
|
|
|
|
|
|
|
# All of the core parts of the kernel are built directly.
|
2015-05-20 21:55:33 +03:00
|
|
|
KERNEL_OBJS = $(patsubst %.c,%.o,$(wildcard kernel/*.c))
|
2015-05-20 10:12:20 +03:00
|
|
|
KERNEL_OBJS += $(patsubst %.c,%.o,$(wildcard kernel/*/*.c))
|
2014-03-10 06:36:28 +04:00
|
|
|
KERNEL_OBJS += $(patsubst %.c,%.o,$(wildcard kernel/*/*/*.c))
|
|
|
|
|
|
|
|
# Loadable modules
|
|
|
|
MODULES = $(patsubst modules/%.c,hdd/mod/%.ko,$(wildcard modules/*.c))
|
2013-12-14 08:50:04 +04:00
|
|
|
|
2014-03-09 09:46:43 +04:00
|
|
|
# We also want to rebuild when a header changes.
|
|
|
|
# This is a naive approach, but it works...
|
|
|
|
HEADERS = $(shell find kernel/include/ -type f -name '*.h')
|
2011-12-15 08:15:47 +04:00
|
|
|
|
2014-05-03 09:38:39 +04:00
|
|
|
# Userspace build flags
|
2016-12-03 11:10:48 +03:00
|
|
|
USER_CFLAGS = -O3 -m32 -Wa,--32 -g -Iuserspace -std=c99 -U__STRICT_ANSI__ -Lhdd/usr/lib
|
2014-05-03 09:38:39 +04:00
|
|
|
USER_CXXFLAGS = -O3 -m32 -Wa,--32 -g -Iuserspace
|
2015-05-20 10:12:20 +03:00
|
|
|
USER_BINFLAGS =
|
2014-05-03 09:38:39 +04:00
|
|
|
|
|
|
|
# Userspace binaries and libraries
|
2016-12-03 11:10:48 +03:00
|
|
|
USER_CFILES = $(filter-out userspace/core/init.c,$(shell find userspace -not -wholename '*/lib/*' -not -wholename '*.static.*' -name '*.c'))
|
2014-05-04 01:06:55 +04:00
|
|
|
USER_CXXFILES = $(shell find userspace -not -wholename '*/lib/*' -name '*.c++')
|
2014-05-03 09:38:39 +04:00
|
|
|
USER_LIBFILES = $(shell find userspace -wholename '*/lib/*' -name '*.c')
|
|
|
|
|
2016-12-03 11:10:48 +03:00
|
|
|
LIBC=hdd/usr/lib/libc.so
|
|
|
|
|
2014-05-03 09:38:39 +04:00
|
|
|
# Userspace output files (so we can define metatargets)
|
|
|
|
USERSPACE = $(foreach file,$(USER_CFILES),$(patsubst %.c,hdd/bin/%,$(notdir ${file})))
|
2014-05-04 01:06:55 +04:00
|
|
|
USERSPACE += $(foreach file,$(USER_CXXFILES),$(patsubst %.c++,hdd/bin/%,$(notdir ${file})))
|
2016-12-03 11:10:48 +03:00
|
|
|
USERSPACE += $(foreach file,$(USER_CSTATICFILES),$(patsubst %.static.c,hdd/bin/%,$(notdir ${file})))
|
2016-12-05 12:07:01 +03:00
|
|
|
USERSPACE += $(foreach file,$(USER_LIBFILES),$(patsubst %.c,hdd/usr/lib/libtoaru-%.so,$(notdir ${file})))
|
2016-12-03 11:24:23 +03:00
|
|
|
USERSPACE += $(LIBC) hdd/bin/init hdd/lib/ld.so
|
2016-12-03 11:10:48 +03:00
|
|
|
#USERSPACE += $(foreach file,$(USER_LIBFILES),$(patsubst %.c,%.o,${file}))
|
2014-03-09 09:46:43 +04:00
|
|
|
|
2014-09-13 09:01:24 +04:00
|
|
|
CORE_LIBS = $(patsubst %.c,%.o,$(wildcard userspace/lib/*.c))
|
|
|
|
|
2014-03-09 09:46:43 +04:00
|
|
|
# Pretty output utilities.
|
2011-10-28 02:39:40 +04:00
|
|
|
BEG = util/mk-beg
|
|
|
|
END = util/mk-end
|
|
|
|
INFO = util/mk-info
|
2012-01-19 05:52:11 +04:00
|
|
|
ERRORS = 2>>/tmp/.`whoami`-build-errors || util/mk-error
|
|
|
|
ERRORSS = >>/tmp/.`whoami`-build-errors || util/mk-error
|
2011-10-28 02:39:40 +04:00
|
|
|
BEGRM = util/mk-beg-rm
|
|
|
|
ENDRM = util/mk-end-rm
|
2011-01-17 22:58:31 +03:00
|
|
|
|
2014-03-09 09:46:43 +04:00
|
|
|
# Hard disk image generation
|
|
|
|
GENEXT = genext2fs
|
|
|
|
DISK_SIZE = `util/disk_size.sh`
|
|
|
|
DD = dd conv=notrunc
|
|
|
|
|
2014-03-16 04:51:33 +04:00
|
|
|
# Specify which modules should be included on startup.
|
|
|
|
# There are a few modules that are kinda required for a working system
|
|
|
|
# such as all of the dependencies needed to mount the root partition.
|
|
|
|
# We can also include things like the debug shell...
|
2014-04-09 19:50:57 +04:00
|
|
|
# Note that ordering matters - list dependencies first.
|
2014-03-17 05:39:03 +04:00
|
|
|
BOOT_MODULES := zero random serial
|
2014-03-16 07:05:07 +04:00
|
|
|
BOOT_MODULES += procfs tmpfs ata
|
2014-03-17 05:39:03 +04:00
|
|
|
#BOOT_MODULES += dospart
|
|
|
|
BOOT_MODULES += ext2
|
|
|
|
BOOT_MODULES += debug_shell
|
2014-03-17 02:13:27 +04:00
|
|
|
BOOT_MODULES += ps2mouse ps2kbd
|
2014-03-20 05:56:07 +04:00
|
|
|
BOOT_MODULES += lfbvideo
|
2016-08-30 10:35:50 +03:00
|
|
|
BOOT_MODULES += vidset
|
2014-04-02 11:26:15 +04:00
|
|
|
BOOT_MODULES += packetfs
|
2015-05-15 10:37:37 +03:00
|
|
|
BOOT_MODULES += snd
|
2014-05-19 03:11:14 +04:00
|
|
|
BOOT_MODULES += pcspkr
|
2015-05-13 11:34:02 +03:00
|
|
|
BOOT_MODULES += ac97
|
2015-09-05 00:05:17 +03:00
|
|
|
BOOT_MODULES += net rtl
|
2014-03-16 04:51:33 +04:00
|
|
|
|
|
|
|
# This is kinda silly. We're going to form an -initrd argument..
|
|
|
|
# which is basically -initrd "hdd/mod/%.ko,hdd/mod/%.ko..."
|
|
|
|
# for each of the modules listed above in BOOT_MODULES
|
|
|
|
COMMA := ,
|
2015-05-20 10:12:20 +03:00
|
|
|
EMPTY :=
|
2014-03-16 04:51:33 +04:00
|
|
|
SPACE := $(EMPTY) $(EMPTY)
|
|
|
|
BOOT_MODULES_X = -initrd "$(subst $(SPACE),$(COMMA),$(foreach mod,$(BOOT_MODULES),hdd/mod/$(mod).ko))"
|
|
|
|
|
2014-03-09 09:46:43 +04:00
|
|
|
# Emulator settings
|
|
|
|
EMU = qemu-system-i386
|
|
|
|
EMUARGS = -sdl -kernel toaruos-kernel -m 1024
|
|
|
|
EMUARGS += -serial stdio -vga std
|
|
|
|
EMUARGS += -hda toaruos-disk.img -k en-us -no-frame
|
2015-05-13 11:34:02 +03:00
|
|
|
EMUARGS += -rtc base=localtime -net nic,model=rtl8139 -net user -soundhw pcspk,ac97
|
2015-05-04 04:35:40 +03:00
|
|
|
EMUARGS += -net dump -no-kvm-irqchip
|
2014-03-16 04:51:33 +04:00
|
|
|
EMUARGS += $(BOOT_MODULES_X)
|
2014-03-09 09:46:43 +04:00
|
|
|
EMUKVM = -enable-kvm
|
2011-10-28 04:37:01 +04:00
|
|
|
|
2014-03-16 12:33:01 +04:00
|
|
|
DISK_ROOT = root=/dev/hda
|
2014-04-02 08:24:25 +04:00
|
|
|
VID_QEMU = vid=qemu,,1280,,720
|
2014-04-02 07:07:42 +04:00
|
|
|
START_VGA = start=--vga
|
|
|
|
START_SINGLE = start=--single
|
2015-07-12 12:57:24 +03:00
|
|
|
START_LIVE = start=live-welcome
|
2014-04-02 08:24:25 +04:00
|
|
|
WITH_LOGS = logtoserial=1
|
2014-03-16 12:33:01 +04:00
|
|
|
|
2016-09-02 13:59:07 +03:00
|
|
|
.PHONY: all system install test toolchain userspace modules cdrom toaruos.iso cdrom-big toaruos-big.iso
|
2014-05-03 09:38:39 +04:00
|
|
|
.PHONY: clean clean-soft clean-hard clean-user clean-mods clean-core clean-disk clean-once
|
2014-03-24 06:32:52 +04:00
|
|
|
.PHONY: run vga term headless
|
2016-09-02 13:59:41 +03:00
|
|
|
.PHONY: kvm vga-kvm term-kvm headless-kvm quick
|
2014-04-27 22:29:21 +04:00
|
|
|
.PHONY: debug debug-kvm debug-term debug-term-kvm
|
2014-03-09 09:46:43 +04:00
|
|
|
|
|
|
|
# Prevents Make from removing intermediary files on failure
|
2015-05-20 10:12:20 +03:00
|
|
|
.SECONDARY:
|
2011-01-17 22:58:31 +03:00
|
|
|
|
2014-03-09 09:46:43 +04:00
|
|
|
# Disable built-in rules
|
2015-05-20 10:12:20 +03:00
|
|
|
.SUFFIXES:
|
2014-03-09 09:46:43 +04:00
|
|
|
|
2014-05-16 23:24:21 +04:00
|
|
|
all: system tags userspace
|
|
|
|
system: toaruos-disk.img toaruos-kernel modules
|
2014-05-03 09:38:39 +04:00
|
|
|
userspace: ${USERSPACE}
|
|
|
|
modules: ${MODULES}
|
2011-01-16 04:01:19 +03:00
|
|
|
|
2012-04-20 04:59:59 +04:00
|
|
|
# Various different quick options
|
2011-05-08 04:21:09 +04:00
|
|
|
run: system
|
2014-04-02 07:07:42 +04:00
|
|
|
${EMU} ${EMUARGS} -append "$(VID_QEMU) $(DISK_ROOT)"
|
2011-05-08 04:21:09 +04:00
|
|
|
kvm: system
|
2014-04-20 06:11:31 +04:00
|
|
|
${EMU} ${EMUARGS} ${EMUKVM} -append "$(VID_QEMU) $(DISK_ROOT)"
|
2016-09-02 13:59:41 +03:00
|
|
|
quick: system
|
|
|
|
${EMU} ${EMUARGS} ${EMUKVM} -append "$(VID_QEMU) $(DISK_ROOT) start=quick-launch"
|
2014-04-27 22:29:21 +04:00
|
|
|
debug: system
|
|
|
|
${EMU} ${EMUARGS} -append "$(VID_QEMU) $(WITH_LOGS) $(DISK_ROOT)"
|
|
|
|
debug-kvm: system
|
|
|
|
${EMU} ${EMUARGS} ${EMUKVM} -append "$(VID_QEMU) $(WITH_LOGS) $(DISK_ROOT)"
|
2012-04-13 08:21:38 +04:00
|
|
|
vga: system
|
2014-04-02 07:07:42 +04:00
|
|
|
${EMU} ${EMUARGS} -append "$(START_VGA) $(DISK_ROOT)"
|
2012-04-20 04:59:59 +04:00
|
|
|
vga-kvm: system
|
2014-04-02 07:07:42 +04:00
|
|
|
${EMU} ${EMUARGS} ${EMUKVM} -append "$(START_VGA) $(DISK_ROOT)"
|
2014-09-04 07:53:36 +04:00
|
|
|
debug-vga: system
|
|
|
|
${EMU} ${EMUARGS} -append "$(WITH_LOGS) $(START_VGA) $(DISK_ROOT)"
|
2012-04-20 04:59:59 +04:00
|
|
|
term: system
|
2014-04-02 07:07:42 +04:00
|
|
|
${EMU} ${EMUARGS} -append "$(VID_QEMU) $(START_SINGLE) $(DISK_ROOT)"
|
2012-04-20 04:59:59 +04:00
|
|
|
term-kvm: system
|
2014-04-02 07:07:42 +04:00
|
|
|
${EMU} ${EMUARGS} ${EMUKVM} -append "$(VID_QEMU) $(START_SINGLE) $(DISK_ROOT)"
|
2014-04-27 22:29:21 +04:00
|
|
|
debug-term: system
|
|
|
|
${EMU} ${EMUARGS} -append "$(VID_QEMU) $(START_SINGLE) $(WITH_LOGS) $(DISK_ROOT)"
|
|
|
|
debug-term-kvm: system
|
|
|
|
${EMU} ${EMUARGS} ${EMUKVM} -append "$(VID_QEMU) $(START_SINGLE) $(WITH_LOGS) $(DISK_ROOT)"
|
2013-11-28 07:15:28 +04:00
|
|
|
headless: system
|
2014-04-02 07:07:42 +04:00
|
|
|
${EMU} ${EMUARGS} -display none -append "$(START_VGA) $(DISK_ROOT)"
|
2014-04-12 00:40:26 +04:00
|
|
|
headless-kvm: system
|
|
|
|
${EMU} ${EMUARGS} ${EMUKVM} -display none -append "$(START_VGA) $(DISK_ROOT)"
|
2015-07-12 12:57:24 +03:00
|
|
|
live: system
|
|
|
|
${EMU} ${EMUARGS} -append "$(VID_QEMU) $(START_LIVE) $(DISK_ROOT)"
|
|
|
|
live-kvm: system
|
|
|
|
${EMU} ${EMUARGS} ${EMUKVM} -append "$(VID_QEMU) $(START_LIVE) $(DISK_ROOT)"
|
2012-04-13 08:21:38 +04:00
|
|
|
|
2012-09-02 13:24:25 +04:00
|
|
|
test: system
|
2014-05-12 10:17:41 +04:00
|
|
|
expect util/test.exp
|
2012-09-02 13:24:25 +04:00
|
|
|
|
2014-04-11 11:14:48 +04:00
|
|
|
toolchain:
|
|
|
|
@cd toolchain; ./toolchain-build.sh
|
|
|
|
|
2015-05-21 10:12:09 +03:00
|
|
|
KERNEL_ASMOBJS = $(filter-out kernel/symbols.o,$(patsubst %.S,%.o,$(wildcard kernel/*.S)))
|
2015-05-20 21:55:33 +03:00
|
|
|
|
2011-02-19 07:22:25 +03:00
|
|
|
################
|
|
|
|
# Kernel #
|
|
|
|
################
|
2015-05-20 21:55:33 +03:00
|
|
|
toaruos-kernel: ${KERNEL_ASMOBJS} ${KERNEL_OBJS} kernel/symbols.o
|
2014-03-09 10:17:47 +04:00
|
|
|
@${BEG} "CC" "$<"
|
2015-05-20 21:55:33 +03:00
|
|
|
@${CC} -T kernel/link.ld ${CFLAGS} -nostdlib -o toaruos-kernel ${KERNEL_ASMOBJS} ${KERNEL_OBJS} kernel/symbols.o -lgcc ${ERRORS}
|
2014-03-09 10:17:47 +04:00
|
|
|
@${END} "CC" "$<"
|
2011-10-28 02:39:40 +04:00
|
|
|
@${INFO} "--" "Kernel is ready!"
|
2011-01-16 04:01:19 +03:00
|
|
|
|
2015-05-20 21:55:33 +03:00
|
|
|
kernel/symbols.o: ${KERNEL_ASMOBJS} ${KERNEL_OBJS} util/generate_symbols.py
|
2014-03-10 06:36:28 +04:00
|
|
|
@-rm -f kernel/symbols.o
|
2015-05-20 10:12:20 +03:00
|
|
|
@${BEG} "NM" "Generating symbol list..."
|
2015-05-20 21:55:33 +03:00
|
|
|
@${CC} -T kernel/link.ld ${CFLAGS} -nostdlib -o toaruos-kernel ${KERNEL_ASMOBJS} ${KERNEL_OBJS} -lgcc ${ERRORS}
|
2015-05-20 10:12:20 +03:00
|
|
|
@${NM} toaruos-kernel -g | python2 util/generate_symbols.py > kernel/symbols.S
|
|
|
|
@${END} "NM" "Generated symbol list."
|
|
|
|
@${BEG} "AS" "kernel/symbols.S"
|
|
|
|
@${AS} ${ASFLAGS} kernel/symbols.S -o $@ ${ERRORS}
|
|
|
|
@${END} "AS" "kernel/symbols.S"
|
2011-02-05 22:27:04 +03:00
|
|
|
|
2012-01-29 03:06:07 +04:00
|
|
|
kernel/sys/version.o: kernel/*/*.c kernel/*.c
|
|
|
|
|
2014-03-10 10:31:13 +04:00
|
|
|
hdd/mod/%.ko: modules/%.c ${HEADERS}
|
2014-03-10 06:36:28 +04:00
|
|
|
@${BEG} "CC" "$< [module]"
|
2014-03-10 10:01:30 +04:00
|
|
|
@${CC} -T modules/link.ld -I./kernel/include -nostdlib ${CFLAGS} -c -o $@ $< ${ERRORS}
|
2014-03-10 06:36:28 +04:00
|
|
|
@${END} "CC" "$< [module]"
|
|
|
|
|
2015-05-20 10:12:20 +03:00
|
|
|
kernel/%.o: kernel/%.S
|
|
|
|
@${BEG} "AS" "$<"
|
|
|
|
@${AS} ${ASFLAGS} $< -o $@ ${ERRORS}
|
|
|
|
@${END} "AS" "$<"
|
|
|
|
|
2014-05-03 07:33:09 +04:00
|
|
|
kernel/%.o: kernel/%.c ${HEADERS}
|
2011-10-28 02:39:40 +04:00
|
|
|
@${BEG} "CC" "$<"
|
2015-05-04 04:35:40 +03:00
|
|
|
@${CC} ${CFLAGS} -nostdlib -g -I./kernel/include -c -o $@ $< ${ERRORS}
|
2011-10-28 02:39:40 +04:00
|
|
|
@${END} "CC" "$<"
|
2011-01-17 22:58:31 +03:00
|
|
|
|
2014-05-03 09:38:39 +04:00
|
|
|
#############
|
|
|
|
# Userspace #
|
|
|
|
#############
|
|
|
|
|
2016-12-03 11:10:48 +03:00
|
|
|
# Init must be built static at the moment.
|
|
|
|
hdd/bin/init: userspace/core/init.c
|
|
|
|
@${BEG} "CC" "$< (static)"
|
|
|
|
@${CC} -o $@ -static -Wl,-static $(USER_CFLAGS) $(USER_BINFLAGS) $< ${ERRORS}
|
|
|
|
@${END} "CC" "$< (static)"
|
|
|
|
|
2014-05-03 09:38:39 +04:00
|
|
|
# Libraries
|
2016-12-03 11:10:48 +03:00
|
|
|
define user-c-rule
|
|
|
|
$1: $2 $(shell util/auto-dep.py --deps $2) $(LIBC)
|
|
|
|
@${BEG} "CCSO" "$$<"
|
|
|
|
@${CC} -o $$@ $(USER_CFLAGS) -shared -fPIC $$(shell util/auto-dep.py --cflags $$<) $$< $$(shell util/auto-dep.py --libs $$<) -lc ${ERRORS}
|
|
|
|
@${END} "CCSO" "$$<"
|
|
|
|
endef
|
|
|
|
$(foreach file,$(USER_LIBFILES),$(eval $(call user-c-rule,$(patsubst %.c,hdd/usr/lib/libtoaru-%.so,$(notdir ${file})),${file})))
|
2014-05-03 09:38:39 +04:00
|
|
|
|
|
|
|
# Binaries from C sources
|
|
|
|
define user-c-rule
|
2016-12-03 11:10:48 +03:00
|
|
|
$1: $2 $(shell util/auto-dep.py --deps $2) $(LIBC)
|
2014-05-03 09:38:39 +04:00
|
|
|
@${BEG} "CC" "$$<"
|
2016-12-03 11:10:48 +03:00
|
|
|
@${CC} -o $$@ $(USER_CFLAGS) $(USER_BINFLAGS) -fPIE $$(shell util/auto-dep.py --cflags $$<) $$< $$(shell util/auto-dep.py --libs $$<) -lc ${ERRORS}
|
2014-05-03 09:38:39 +04:00
|
|
|
@${END} "CC" "$$<"
|
|
|
|
endef
|
|
|
|
$(foreach file,$(USER_CFILES),$(eval $(call user-c-rule,$(patsubst %.c,hdd/bin/%,$(notdir ${file})),${file})))
|
|
|
|
|
|
|
|
# Binaries from C++ sources
|
|
|
|
define user-cxx-rule
|
2016-12-03 11:10:48 +03:00
|
|
|
$1: $2 $(shell util/auto-dep.py --deps $2) $(LIBC)
|
2014-05-04 01:06:55 +04:00
|
|
|
@${BEG} "C++" "$$<"
|
2016-12-03 11:10:48 +03:00
|
|
|
@${CXX} -o $$@ $(USER_CXXFLAGS) $(USER_BINFLAGS) -static -Wl,-static $$(shell util/auto-dep.py --cflags $$<) $$< $$(shell util/auto-dep.py --libs $$<) -lc ${ERRORS}
|
2014-05-04 01:06:55 +04:00
|
|
|
@${END} "C++" "$$<"
|
2014-05-03 09:38:39 +04:00
|
|
|
endef
|
2014-05-04 01:06:55 +04:00
|
|
|
$(foreach file,$(USER_CXXFILES),$(eval $(call user-cxx-rule,$(patsubst %.c++,hdd/bin/%,$(notdir ${file})),${file})))
|
2014-05-03 09:38:39 +04:00
|
|
|
|
2014-09-13 09:01:24 +04:00
|
|
|
hdd/usr/lib/libtoaru.a: ${CORE_LIBS}
|
|
|
|
@${BEG} "AR" "$@"
|
|
|
|
@${AR} rcs $@ ${CORE_LIBS}
|
|
|
|
@mkdir -p hdd/usr/include/toaru
|
|
|
|
@cp userspace/lib/*.h hdd/usr/include/toaru/
|
|
|
|
@${END} "AR" "$@"
|
|
|
|
|
2016-11-21 13:29:52 +03:00
|
|
|
hdd/usr/lib/libnetwork.a: userspace/lib/network.o
|
|
|
|
@${BEG} "AR" "$@"
|
|
|
|
@${AR} rcs $@ ${CORE_LIBS}
|
|
|
|
@${END} "AR" "$@"
|
|
|
|
|
2016-12-03 11:10:48 +03:00
|
|
|
# Bad implementations of shared libraries
|
|
|
|
hdd/usr/lib/libc.so: ${TOOLCHAIN}/lib/libc.a
|
|
|
|
cd linker; make libc.so
|
2016-12-03 11:20:31 +03:00
|
|
|
mkdir -p hdd/usr/lib
|
2016-12-03 11:10:48 +03:00
|
|
|
cp linker/libc.so hdd/usr/lib/
|
|
|
|
|
2016-12-03 11:24:23 +03:00
|
|
|
hdd/lib/ld.so: linker/linker.c
|
2016-12-03 11:10:48 +03:00
|
|
|
cd linker; make ld.so
|
|
|
|
mkdir -p hdd/lib
|
|
|
|
cp linker/ld.so hdd/lib/
|
|
|
|
|
|
|
|
define basic-so-wrapper
|
|
|
|
hdd/usr/lib/lib$(1).so: ${TOOLCHAIN}/lib/lib$(1).a
|
|
|
|
@${BEG} "SO" "$$@"
|
|
|
|
@${CC} -shared -Wl,-soname,lib$(1).so -o hdd/usr/lib/lib$(1).so -Lhdd/usr/lib -Wl,--whole-archive ${TOOLCHAIN}/lib/lib$(1).a -Wl,--no-whole-archive $2
|
|
|
|
@${END} "SO" "$$@"
|
|
|
|
endef
|
|
|
|
|
|
|
|
$(eval $(call basic-so-wrapper,m,))
|
|
|
|
$(eval $(call basic-so-wrapper,z,))
|
|
|
|
$(eval $(call basic-so-wrapper,ncurses,))
|
|
|
|
$(eval $(call basic-so-wrapper,panel,-lncurses))
|
|
|
|
$(eval $(call basic-so-wrapper,png15,-lz))
|
|
|
|
$(eval $(call basic-so-wrapper,pixman-1,-lm))
|
|
|
|
$(eval $(call basic-so-wrapper,cairo,-lpixman-1 -lpng15 -lfreetype))
|
|
|
|
$(eval $(call basic-so-wrapper,freetype,-lz))
|
|
|
|
|
2011-10-28 04:37:01 +04:00
|
|
|
####################
|
|
|
|
# Hard Disk Images #
|
|
|
|
####################
|
|
|
|
|
2015-05-04 04:35:40 +03:00
|
|
|
toaruos-disk.img: ${USERSPACE} util/devtable
|
2011-10-28 04:37:01 +04:00
|
|
|
@${BEG} "hdd" "Generating a Hard Disk image..."
|
|
|
|
@-rm -f toaruos-disk.img
|
2014-05-26 08:59:51 +04:00
|
|
|
@${GENEXT} -B 4096 -d hdd -D util/devtable -U -b ${DISK_SIZE} -N 4096 toaruos-disk.img ${ERRORS}
|
2011-10-28 04:37:01 +04:00
|
|
|
@${END} "hdd" "Generated Hard Disk image"
|
|
|
|
@${INFO} "--" "Hard disk image is ready!"
|
|
|
|
|
2015-06-19 07:33:07 +03:00
|
|
|
#########
|
|
|
|
# cdrom #
|
|
|
|
#########
|
|
|
|
|
|
|
|
cdrom: toaruos.iso
|
|
|
|
|
2016-09-02 13:59:07 +03:00
|
|
|
cdrom-big: toaruos-big.iso
|
|
|
|
|
2015-06-19 07:33:07 +03:00
|
|
|
toaruos.iso:
|
|
|
|
util/make-cdrom.sh
|
|
|
|
|
2016-09-02 13:59:07 +03:00
|
|
|
toaruos-big.iso:
|
|
|
|
util/make-cdrom-big.sh
|
|
|
|
|
2012-01-27 11:38:08 +04:00
|
|
|
##############
|
|
|
|
# ctags #
|
|
|
|
##############
|
2014-05-05 04:17:40 +04:00
|
|
|
tags: kernel/*/*.c kernel/*.c userspace/**/*.c modules/*.c
|
2012-01-27 11:38:08 +04:00
|
|
|
@${BEG} "ctag" "Generating CTags..."
|
2014-05-05 04:17:40 +04:00
|
|
|
@-ctags -R --c++-kinds=+p --fields=+iaS --extra=+q kernel userspace modules util ${ERRORS}
|
2012-01-27 11:38:08 +04:00
|
|
|
@${END} "ctag" "Generated CTags."
|
|
|
|
|
2011-02-21 22:29:09 +03:00
|
|
|
###############
|
|
|
|
# clean #
|
|
|
|
###############
|
2011-10-27 03:39:36 +04:00
|
|
|
|
|
|
|
clean-soft:
|
2015-05-22 00:30:02 +03:00
|
|
|
@${BEGRM} "RM" "Cleaning kernel objects..."
|
2011-02-13 01:47:20 +03:00
|
|
|
@-rm -f kernel/*.o
|
2014-03-17 00:30:25 +04:00
|
|
|
@-rm -f kernel/*/*.o
|
2014-03-10 06:36:28 +04:00
|
|
|
@-rm -f ${KERNEL_OBJS}
|
2015-05-22 00:30:02 +03:00
|
|
|
@${ENDRM} "RM" "Cleaned kernel objects"
|
2011-10-27 03:39:36 +04:00
|
|
|
|
2014-05-03 09:38:39 +04:00
|
|
|
clean-user:
|
|
|
|
@${BEGRM} "RM" "Cleaning userspace products..."
|
|
|
|
@-rm -f ${USERSPACE}
|
|
|
|
@${ENDRM} "RM" "Cleaned userspace products"
|
2011-10-27 03:39:36 +04:00
|
|
|
|
2014-03-11 12:55:51 +04:00
|
|
|
clean-mods:
|
|
|
|
@${BEGRM} "RM" "Cleaning kernel modules..."
|
|
|
|
@-rm -f hdd/mod/*
|
|
|
|
@${ENDRM} "RM" "Cleaned kernel modules"
|
|
|
|
|
2011-10-27 03:39:36 +04:00
|
|
|
clean-core:
|
2011-10-28 02:39:40 +04:00
|
|
|
@${BEGRM} "RM" "Cleaning final output..."
|
2011-10-27 03:39:36 +04:00
|
|
|
@-rm -f toaruos-kernel
|
2011-10-28 02:39:40 +04:00
|
|
|
@${ENDRM} "RM" "Cleaned final output"
|
2011-10-27 03:39:36 +04:00
|
|
|
|
2011-12-27 05:23:58 +04:00
|
|
|
clean-disk:
|
|
|
|
@${BEGRM} "RM" "Deleting hard disk image..."
|
|
|
|
@-rm -f toaruos-disk.img
|
|
|
|
@${ENDRM} "RM" "Deleted hard disk image"
|
|
|
|
|
2014-03-11 12:55:51 +04:00
|
|
|
clean: clean-soft clean-core
|
|
|
|
@${INFO} "--" "Finished soft cleaning"
|
|
|
|
|
2014-05-03 09:38:39 +04:00
|
|
|
clean-hard: clean clean-user clean-mods
|
2014-03-11 12:55:51 +04:00
|
|
|
@${INFO} "--" "Finished hard cleaning"
|
|
|
|
|
|
|
|
|
2011-04-18 02:44:29 +04:00
|
|
|
# vim:noexpandtab
|
|
|
|
# vim:tabstop=4
|
|
|
|
# vim:shiftwidth=4
|