diff options
| author | Matt Borgerson <contact@mborgerson.com> | 2019-12-17 19:45:49 -0700 |
|---|---|---|
| committer | Matt Borgerson <contact@mborgerson.com> | 2019-12-17 19:45:49 -0700 |
| commit | af1a586beb952808238834a4d65531936a97f0de (patch) | |
| tree | c221a14ce6f6ba176929c21ec3f263504a0ea7f6 /Makefile | |
| parent | 12c212b99255d0984a2e39239395403900959024 (diff) | |
| download | gdbstub-af1a586beb952808238834a4d65531936a97f0de.tar.gz | |
Add a demo and instructions on how to run with QEMU
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -22,6 +22,9 @@ ARCH := x86 +# Include a simple demo that can be debugged +INCLUDE_DEMO = 1 + CC = gcc CFLAGS = -Werror -ansi -Os -g -ffunction-sections -fno-stack-protector -I$(ARCH) -I$(PWD) LD = ld @@ -43,6 +46,10 @@ else $(error Please specify a supported architecture) endif +ifeq ($(INCLUDE_DEMO),1) +OBJECTS += demo.o +endif + all: $(TARGET) .PRECIOUS: %.elf @@ -52,8 +59,11 @@ all: $(TARGET) %.elf: $(OBJECTS) gdbstub.ld $(LD) $(LDFLAGS) -o $@ $(OBJECTS) -gdbstub.ld: gdbstub.ld.in - $(shell sed -e "s/\$$BASE_ADDRESS/$(BASE_ADDRESS)/" gdbstub.ld.in > gdbstub.ld) +gdbstub.ld: gdbstub.ld.in Makefile + $(CC) -o $@ -x c -P -E \ + -DBASE_ADDRESS=$(BASE_ADDRESS) \ + -DINCLUDE_DEMO=$(INCLUDE_DEMO) \ + $< %.o: %.c $(CC) $(CFLAGS) -o $@ -c $< |
