Makefile 3.38 KB
Newer Older
Jeremy Soller's avatar
Jeremy Soller committed
1 2
# Configuration and variables
include mk/config.mk
3

4 5
all: build/harddrive.bin

6 7
coreboot: build/coreboot.elf

8
live: build/livedisk.bin
Jeremy Soller's avatar
Jeremy Soller committed
9

Jeremy Soller's avatar
Jeremy Soller committed
10
iso: build/livedisk.iso
11

12
clean:
13
	cd cookbook && ./clean.sh
14 15
	cargo clean --manifest-path cookbook/pkgutils/Cargo.toml
	cargo clean --manifest-path installer/Cargo.toml
16
	cargo clean --manifest-path kernel/Cargo.toml
Jeremy Soller's avatar
Jeremy Soller committed
17
	cargo clean --manifest-path kernel/syscall/Cargo.toml
18
	cargo clean --manifest-path redoxfs/Cargo.toml
19
	-$(FUMOUNT) build/filesystem/ || true
20
	rm -rf build
21

Jeremy Soller's avatar
Jeremy Soller committed
22
distclean:
23
	$(MAKE) clean
Jeremy Soller's avatar
Jeremy Soller committed
24 25
	cd cookbook && ./unfetch.sh

Jeremy Soller's avatar
Jeremy Soller committed
26
pull:
27 28
	git pull --recurse-submodules
	git submodule sync --recursive
Jeremy Soller's avatar
Jeremy Soller committed
29
	git submodule update --recursive --init
30 31

update:
Jeremy Soller's avatar
Jeremy Soller committed
32 33 34
	cd cookbook && ./update.sh \
		"$$(cargo run --manifest-path ../installer/Cargo.toml -- --list-packages -c ../initfs.toml)" \
		"$$(cargo run --manifest-path ../installer/Cargo.toml -- --list-packages -c ../filesystem.toml)"
35 36 37
	cargo update --manifest-path cookbook/pkgutils/Cargo.toml
	cargo update --manifest-path installer/Cargo.toml
	cargo update --manifest-path kernel/Cargo.toml
38
	cargo update --manifest-path redoxfs/Cargo.toml
Jeremy Soller's avatar
Jeremy Soller committed
39

Ian Douglas Scott's avatar
Ian Douglas Scott committed
40
fetch:
Jeremy Soller's avatar
Jeremy Soller committed
41 42 43
	cd cookbook && ./fetch.sh \
		"$$(cargo run --manifest-path ../installer/Cargo.toml -- --list-packages -c ../initfs.toml)" \
		"$$(cargo run --manifest-path ../installer/Cargo.toml -- --list-packages -c ../filesystem.toml)"
Ian Douglas Scott's avatar
Ian Douglas Scott committed
44

45
# Cross compiler recipes
46
include mk/prefix.mk
Jeremy Soller's avatar
Jeremy Soller committed
47

48
# Kernel recipes
Jeremy Soller's avatar
Jeremy Soller committed
49
include mk/kernel.mk
50

Jeremy Soller's avatar
Jeremy Soller committed
51 52 53
# Filesystem recipes
include mk/initfs.mk
include mk/filesystem.mk
54

Jeremy Soller's avatar
Jeremy Soller committed
55 56
# Disk images
include mk/disk.mk
Jeremy Soller's avatar
Jeremy Soller committed
57

58 59 60 61 62
# Emulation recipes
include mk/qemu.mk
include mk/bochs.mk
include mk/virtualbox.mk

Jeremy Soller's avatar
Jeremy Soller committed
63 64
# CI image target
ci-img: FORCE
65
	$(MAKE) INSTALLER_FLAGS= \
66 67 68 69 70
		build/coreboot.elf.gz \
		build/harddrive.bin.gz \
		build/livedisk.iso.gz \
		build/harddrive-efi.bin.gz \
		build/livedisk-efi.iso.gz
Jeremy Soller's avatar
Jeremy Soller committed
71
	rm -rf build/img
72
	mkdir -p build/img
73 74 75 76 77
	cp "build/coreboot.elf.gz" "build/img/redox_$(IMG_TAG)_coreboot.elf.gz"
	cp "build/harddrive.bin.gz" "build/img/redox_$(IMG_TAG)_harddrive.bin.gz"
	cp "build/livedisk.iso.gz" "build/img/redox_$(IMG_TAG)_livedisk.iso.gz"
	cp "build/harddrive-efi.bin.gz" "build/img/redox_$(IMG_TAG)_harddrive-efi.bin.gz"
	cp "build/livedisk-efi.iso.gz" "build/img/redox_$(IMG_TAG)_livedisk-efi.iso.gz"
Jeremy Soller's avatar
Jeremy Soller committed
78 79 80
	cd build/img && sha256sum -b * > SHA256SUM

# CI packaging target
81 82 83 84 85 86
ci-pkg: prefix FORCE
	export PATH="$(PREFIX_PATH):$$PATH" && \
	PACKAGES="$$(cargo run --manifest-path installer/Cargo.toml -- --list-packages -c ci.toml)" && \
	cd cookbook && \
	./fetch.sh "$${PACKAGES}" && \
	./repo.sh "$${PACKAGES}"
87

88
# CI toolchain
89 90 91
ci-toolchain: FORCE
	$(MAKE) PREFIX_BINARY=0 \
		"prefix/$(TARGET)/gcc-install.tar.gz" \
92 93
		"prefix/$(TARGET)/relibc-install.tar.gz" \
		"prefix/$(TARGET)/rust-install.tar.gz"
94
	rm -rf "build/toolchain/$(TARGET)"
95
	mkdir -p "build/toolchain/$(TARGET)"
96 97
	cp "prefix/$(TARGET)/gcc-install.tar.gz" "build/toolchain/$(TARGET)/gcc-install.tar.gz"
	cp "prefix/$(TARGET)/relibc-install.tar.gz" "build/toolchain/$(TARGET)/relibc-install.tar.gz"
98
	cp "prefix/$(TARGET)/rust-install.tar.gz" "build/toolchain/$(TARGET)/rust-install.tar.gz"
99 100
	cd "build/toolchain/$(TARGET)" && sha256sum -b * > SHA256SUM

101 102 103 104
env: prefix FORCE
	export PATH="$(PREFIX_PATH):$$PATH" && \
	bash

105 106 107
# An empty target
FORCE:

108 109 110 111 112
# Gzip any binary
%.gz: %
	gzip -k -f $<

# Create a listing for any binary
113
%.list: %
Jeremy Soller's avatar
Jeremy Soller committed
114
	export PATH="$(PREFIX_PATH):$$PATH" && \
115
	$(OBJDUMP) -C -M intel -D $< > $@
116 117

# Wireshark
Jeremy Soller's avatar
Jeremy Soller committed
118
wireshark: FORCE
119
	wireshark build/network.pcap