aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Borgerson <contact@mborgerson.com>2019-12-17 14:05:36 -0700
committerMatt Borgerson <contact@mborgerson.com>2019-12-17 14:05:36 -0700
commit52ed1fea94945cb49da5d72738b851564b90be5d (patch)
treedb78edcef6db780e9dfd9b3f28acebbe792621f2
parent1e1c2631b6e0404336e6509ba3f082ba576987c1 (diff)
downloadgdbstub-52ed1fea94945cb49da5d72738b851564b90be5d.tar.gz
Move x86-specific code to a subdir
-rw-r--r--Makefile35
-rw-r--r--x86/gdbstub_int.nasm (renamed from gdbstub_int.nasm)0
-rw-r--r--x86/gdbstub_sys.c (renamed from gdbstub_sys.c)0
-rw-r--r--x86/gdbstub_sys.h (renamed from gdbstub_sys.h)0
4 files changed, 22 insertions, 13 deletions
diff --git a/Makefile b/Makefile
index 6e35c06..cd8189a 100644
--- a/Makefile
+++ b/Makefile
@@ -20,19 +20,28 @@
# SOFTWARE.
#
-CC := gcc
-CFLAGS := -Werror -ansi -Os -m32 -g -ffunction-sections -fno-stack-protector
-LD := ld
-LDFLAGS := --script=gdbstub.ld -m elf_i386 --gc-sections
-NASM := nasm
-NASM_FLAGS := -felf
-OBJCOPY := objcopy
-OBJCOPYFLAGS := --output-target=binary
-TARGET := gdbstub.bin
-BASE_ADDRESS := 0x500000
-OBJECTS := gdbstub_rsp.o \
- gdbstub_int.o \
- gdbstub_sys.o
+ARCH := x86
+
+CC = gcc
+CFLAGS = -Werror -ansi -Os -g -ffunction-sections -fno-stack-protector -I$(ARCH) -I$(PWD)
+LD = ld
+LDFLAGS = --script=gdbstub.ld --gc-sections
+NASM = nasm
+NASM_FLAGS = -felf
+OBJCOPY = objcopy
+OBJCOPYFLAGS = --output-target=binary
+TARGET = gdbstub.bin
+BASE_ADDRESS = 0x500000
+OBJECTS = gdbstub_rsp.o \
+ $(ARCH)/gdbstub_sys.o
+
+ifeq ($(ARCH),x86)
+CFLAGS += -m32
+LDFLAGS += -m elf_i386
+OBJECTS += $(ARCH)/gdbstub_int.o
+else
+$(error Please specify a supported architecture)
+endif
all: $(TARGET)
.PRECIOUS: %.elf
diff --git a/gdbstub_int.nasm b/x86/gdbstub_int.nasm
index 2495971..2495971 100644
--- a/gdbstub_int.nasm
+++ b/x86/gdbstub_int.nasm
diff --git a/gdbstub_sys.c b/x86/gdbstub_sys.c
index 8919c21..8919c21 100644
--- a/gdbstub_sys.c
+++ b/x86/gdbstub_sys.c
diff --git a/gdbstub_sys.h b/x86/gdbstub_sys.h
index 639e8bd..639e8bd 100644
--- a/gdbstub_sys.h
+++ b/x86/gdbstub_sys.h