38 lines
827 B
Makefile
38 lines
827 B
Makefile
ARCH = x86
|
|
NEWLIB = ../x86/i586-metalsvm-elf32
|
|
MAKE = make
|
|
CC = gcc
|
|
CFLAGS = -g -m32 -O2 -nostdinc -Wall -fno-builtin -I$(NEWLIB)/include -I../../include -I../../arch/$(ARCH)/include -fno-stack-protector
|
|
LDFLAGS = -m32 -nostdlib -L$(NEWLIB)/lib
|
|
OBJCOPY = objcopy
|
|
STRIP_DEBUG = --strip-debug
|
|
KEEP_DEBUG = --only-keep-debug
|
|
|
|
# other implicit rules
|
|
%.o : %.c
|
|
$(CC) -c $(CFLAGS) -o $@ $<
|
|
|
|
default: all
|
|
|
|
all: hello tests
|
|
|
|
tests: tests.o
|
|
$(CC) -T link.ld -o $@ $(LDFLAGS) $<
|
|
$(OBJCOPY) $(KEEP_DEBUG) $@ $@.sym
|
|
$(OBJCOPY) $(STRIP_DEBUG) $@
|
|
chmod a-x $@.sym
|
|
|
|
hello: hello.o
|
|
$(CC) -T link.ld -o $@ $(LDFLAGS) $<
|
|
$(OBJCOPY) $(KEEP_DEBUG) $@ $@.sym
|
|
$(OBJCOPY) $(STRIP_DEBUG) $@
|
|
chmod a-x $@.sym
|
|
|
|
clean:
|
|
$(RM) hello tests *.sym *.o *~
|
|
|
|
depend:
|
|
$(CC) -MM $(CFLAGS) *.c > Makefile.dep
|
|
|
|
-include Makefile.dep
|
|
# DO NOT DELETE
|