Makefile 686 Bytes
Newer Older
1 2
# Alessandro Rubini for CERN, 2011 -- public domain

3
CFLAGS += -ffreestanding -Os -fno-stack-protector
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
ARCH_LDFLAGS = -nostdlib -static -T $(ARCH).lds

# All files are under A (short for ARCH): I'm lazy
A := arch-$(ARCH)

LIBARCH := $A/libarch.a

OBJ-libarch := $A/bare-startup.o \
	$A/main-loop.o \
	$A/bare-socket.o \
	$A/bare-io.o \
	$A/syscalls.o

$(LIBARCH): $(OBJ-libarch)
	$(AR) r $@ $^

all: $(TARGET)

# to build the target, we need -lstd again, in case we call functions that
# were not selected yet (e.g., pp_open_instance() ).
$(TARGET): $(TARGET).o $A/crt0.o $(LIBARCH)
	$(CC) -Wl,-Map,$(TARGET).map2 $(ARCH_LDFLAGS) -o $@ $A/crt0.o \
		$(TARGET).o -L$A -larch -L$D -lstd