Skip to content

Commit

Permalink
tests: build test multiboot kernel
Browse files Browse the repository at this point in the history
  • Loading branch information
fabianfreyer committed Feb 18, 2018
1 parent 65b5fb4 commit 47dafd9
Showing 1 changed file with 22 additions and 10 deletions.
32 changes: 22 additions & 10 deletions tests/data/multiboot/Makefile
Original file line number Diff line number Diff line change
@@ -1,21 +1,33 @@
CC=gcc
CCFLAGS=-m32 -Wall -Wextra -Werror -fno-stack-protector -nostdinc -fno-builtin
ASFLAGS=-m32

LD=ld
LDFLAGS=-melf_i386 -T link.ld
LIBS=$(shell $(CC) $(CCFLAGS) -print-libgcc-file-name)
UNAME_S!=uname -s
LIBGCC!=$(CC) $(CCFLAGS) -print-libgcc-file-name

LDEMULATION=elf_i386
.if ${UNAME_S:MFreeBSD}
LDEMULATION=elf_i386_fbsd
.endif

LDFLAGS=-melf_i386_fbsd -T link.ld

.PHONY: all
all: mmap.elf modules.elf

.PHONY: clean
clean:
rm -f start.o mmap.o libc.o
rm -f mmap.elf
rm -f modules.elf

mmap.elf: start.o mmap.o libc.o
$(LD) $(LDFLAGS) -o $@ $^ $(LIBS)
$(LD) $(LDFLAGS) -o $@ $> $(LIBGCC)

modules.elf: start.o modules.o libc.o
$(LD) $(LDFLAGS) -o $@ $^ $(LIBS)
$(LD) $(LDFLAGS) -o $@ $> $(LIBGCC)

%.o: %.c
$(CC) $(CCFLAGS) -c -o $@ $^
.c.o:
$(CC) $(CCFLAGS) -c -o $@ $<

%.o: %.S
$(CC) $(ASFLAGS) -c -o $@ $^
.S.o:
$(CC) $(ASFLAGS) -c -o $@ $<

0 comments on commit 47dafd9

Please sign in to comment.