summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2019-07-27 12:21:13 -0700
committerH. Peter Anvin <hpa@zytor.com>2019-07-27 12:21:13 -0700
commit386ca9893ba0d35a34069c2fec3d59185691fd0e (patch)
tree93fcfc144cf9228f6397e60290bb9e9ffbee3ffc
parent069ba5471f082ad2ac515c9d102903a820db57a2 (diff)
downloadsamples-386ca9893ba0d35a34069c2fec3d59185691fd0e.tar.gz
samples-386ca9893ba0d35a34069c2fec3d59185691fd0e.tar.xz
samples-386ca9893ba0d35a34069c2fec3d59185691fd0e.zip
Produce actual .com files and add support for producing .exe files
This is actually bogus: .com files (tiny model) generally needs different source code from .exe files (small, medium, compact, large, huge models.)
-rw-r--r--Makefile14
1 files changed, 11 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index dec2e65..4d95bef 100644
--- a/Makefile
+++ b/Makefile
@@ -9,16 +9,24 @@ ASFLAGS = --32
LD = $(CROSS)ld
LDFLAGS = -m elf_i386 -q -z max-page-size=16
+OBJCOPY = $(CROSS)objcopy
+
OBJS = testme.o
-ALL = exe.elf com.elf
+ALL = testme.exe.elf testme.com.elf testme.com # testme.exe
# Don't erase intermediate files
.SECONDARY:
all: $(ALL)
-%.elf: %.ld $(OBJS)
- $(LD) $(LDFLAGS) -Map=$*.map -T $*.ld -o $@ $(OBJS)
+%.exe.elf: $(OBJS) exe.ld
+ $(LD) $(LDFLAGS) -Map=$*.map -T exe.ld -o $@ $(OBJS)
+
+%.com.elf: $(OBJS) com.ld
+ $(LD) $(LDFLAGS) -Map=$*.map -T com.ld -o $@ $(OBJS)
+
+%.com: %.com.elf
+ $(OBJCOPY) -O binary $< $@
%.o: %.s
$(AS) $(ASFLAGS) -aghlms=$*.lst -o $@ $<