2013-06-27 13:50:05 +02:00
|
|
|
CC=gcc
|
|
|
|
CCFLAGS=-m32 -Wall -Wextra -Werror -fno-stack-protector -nostdinc -fno-builtin
|
|
|
|
ASFLAGS=-m32
|
|
|
|
|
|
|
|
LD=ld
|
2018-03-14 13:33:49 +01:00
|
|
|
LDFLAGS_ELF=-melf_i386 -T link.ld
|
|
|
|
LDFLAGS_BIN=-melf_i386 -T link.ld --oformat=binary
|
2013-06-27 13:50:05 +02:00
|
|
|
LIBS=$(shell $(CC) $(CCFLAGS) -print-libgcc-file-name)
|
|
|
|
|
2018-03-14 13:33:49 +01:00
|
|
|
AOUT_KLUDGE_BIN=$(foreach x,$(shell seq 1 9),aout_kludge_$x.bin)
|
2013-06-27 13:50:05 +02:00
|
|
|
|
2018-03-14 13:33:49 +01:00
|
|
|
all: mmap.elf modules.elf $(AOUT_KLUDGE_BIN)
|
2013-06-27 13:50:05 +02:00
|
|
|
|
2018-03-14 13:33:49 +01:00
|
|
|
mmap.elf: start.o mmap.o libc.o link.ld
|
|
|
|
$(LD) $(LDFLAGS_ELF) -o $@ $^ $(LIBS)
|
|
|
|
|
|
|
|
modules.elf: start.o modules.o libc.o link.ld
|
|
|
|
$(LD) $(LDFLAGS_ELF) -o $@ $^ $(LIBS)
|
|
|
|
|
|
|
|
aout_kludge_%.bin: aout_kludge_%.o link.ld
|
|
|
|
$(LD) $(LDFLAGS_BIN) -o $@ $^ $(LIBS)
|
|
|
|
|
|
|
|
.PRECIOUS: aout_kludge_%.o
|
|
|
|
aout_kludge_%.o: aout_kludge.S
|
|
|
|
$(CC) $(ASFLAGS) -DSCENARIO=$* -c -o $@ $^
|
2015-01-15 12:26:44 +01:00
|
|
|
|
2013-06-27 13:50:05 +02:00
|
|
|
%.o: %.c
|
|
|
|
$(CC) $(CCFLAGS) -c -o $@ $^
|
|
|
|
|
|
|
|
%.o: %.S
|
|
|
|
$(CC) $(ASFLAGS) -c -o $@ $^
|