aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrammell hudson <hudson@trmm.net>2020-03-13 14:51:11 +0100
committerTrammell hudson <hudson@trmm.net>2020-03-13 15:17:38 +0100
commitbb7e95989e998bba3e5a58fb97dfb0c41eef23f9 (patch)
tree2aa06c8a4243e637ac4da881c15d023475090dd9
parent96842c5a646fe1f70a352e14bf380743100876ee (diff)
downloadqboot-bb7e95989e998bba3e5a58fb97dfb0c41eef23f9.zip
qboot-bb7e95989e998bba3e5a58fb97dfb0c41eef23f9.tar.gz
qboot-bb7e95989e998bba3e5a58fb97dfb0c41eef23f9.tar.bz2
Replace meson with simple Makefile
Signed-off-by: Trammell hudson <hudson@trmm.net>
-rw-r--r--Makefile62
-rw-r--r--meson.build52
2 files changed, 62 insertions, 52 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..94dc3dd
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,62 @@
+CC ?= $(CROSS)gcc
+AS ?= $(CROSS)gcc
+OBJCOPY ?= $(CROSS)objcopy
+
+CFLAGS := \
+ -W \
+ -Wall \
+ -m32 \
+ -march=i386 \
+ -mregparm=3 \
+ -fno-stack-protector \
+ -fno-delete-null-pointer-checks \
+ -ffreestanding \
+ -mstringop-strategy=rep_byte \
+ -minline-all-stringops \
+ -fno-pic \
+ -Iinclude \
+
+ASFLAGS := $(CFLAGS)
+
+LDFLAGS := \
+ -nostdlib \
+ -m32 \
+ -Wl,--build-id=none \
+ -Wl,-Tflat.lds \
+
+all: bios.bin
+
+%.bin: %.elf
+ $(OBJCOPY) \
+ -O binary \
+ -j .text \
+ -j .data \
+ -j .rodata \
+ -j .bss \
+ -j .data \
+ -j .init \
+ $< \
+ $@
+
+OBJS := \
+ code16.o \
+ code32seg.o \
+ cstart.o \
+ entry.o \
+ fw_cfg.o \
+ hwsetup.o \
+ linuxboot.o \
+ main.o \
+ malloc.o \
+ mptable.o \
+ pci.o \
+ printf.o \
+ string.o \
+ smbios.o \
+ tables.o \
+
+bios.elf: $(OBJS)
+ $(CC) $(LDFLAGS) -o $@ $^
+
+clean:
+ $(RM) *.o bios.bin bios.bin.elf .*.d
diff --git a/meson.build b/meson.build
deleted file mode 100644
index ce291a3..0000000
--- a/meson.build
+++ /dev/null
@@ -1,52 +0,0 @@
-project('qboot', 'c')
-
-cc = meson.get_compiler('c')
-objcopy = find_program('objcopy')
-
-c_args = [
- '-m32',
- '-march=i386',
- '-mregparm=3',
- '-fno-stack-protector',
- '-fno-delete-null-pointer-checks',
- '-ffreestanding',
- '-mstringop-strategy=rep_byte',
- '-minline-all-stringops',
- '-fno-pic',
-]
-
-link_args = ['-nostdlib', '-m32']
-link_args += cc.get_supported_link_arguments('-Wl,--build-id=none')
-link_args += '-Wl,-T' + meson.current_source_dir() / 'flat.lds'
-
-elf = executable(
- 'bios.bin.elf',
- files(
- 'code16.c',
- 'code32seg.c',
- 'cstart.S',
- 'entry.S',
- 'fw_cfg.c',
- 'hwsetup.c',
- 'linuxboot.c',
- 'main.c',
- 'malloc.c',
- 'mptable.c',
- 'pci.c',
- 'printf.c',
- 'string.c',
- 'smbios.c',
- 'tables.c',
- ),
- c_args: c_args,
- include_directories: include_directories('include'),
- link_args: link_args,
-)
-
-bin = custom_target(
- 'bios.bin',
- output: 'bios.bin',
- input: elf,
- command: [objcopy, '-O', 'binary', '@INPUT@', '@OUTPUT@'],
- build_by_default: true,
-)