47 lines
872 B
Makefile
47 lines
872 B
Makefile
CC = ../toolchain/bin/i386-elf-gcc
|
|
LD = ../toolchain/bin/i386-elf-gcc
|
|
OBJCOPY = ../toolchain/bin/i386-elf-objcopy
|
|
|
|
CFLAGS = -flto -Os -pipe -Wall -Wextra
|
|
|
|
INTERNAL_CFLAGS = \
|
|
-std=gnu99 \
|
|
-ffreestanding \
|
|
-fno-stack-protector \
|
|
-fno-pic \
|
|
-fomit-frame-pointer \
|
|
-mno-80387 \
|
|
-mno-mmx \
|
|
-mno-3dnow \
|
|
-mno-sse \
|
|
-mno-sse2 \
|
|
-I. \
|
|
-Wno-address-of-packed-member
|
|
|
|
LDFLAGS = -flto -Os
|
|
|
|
INTERNAL_LDFLAGS = \
|
|
-lgcc \
|
|
-static-libgcc \
|
|
-nostdlib \
|
|
-no-pie \
|
|
-static \
|
|
-Tlinker.ld
|
|
|
|
.PHONY: all clean
|
|
|
|
C_FILES := $(shell find ./ -type f -name '*.c' | sort)
|
|
OBJ := $(C_FILES:.c=.o)
|
|
|
|
all: decompressor.bin
|
|
|
|
decompressor.bin: $(OBJ)
|
|
$(LD) $(OBJ) $(LDFLAGS) $(INTERNAL_LDFLAGS) -o decompressor.elf
|
|
$(OBJCOPY) -O binary decompressor.elf decompressor.bin
|
|
|
|
%.o: %.c
|
|
$(CC) $(CFLAGS) $(INTERNAL_CFLAGS) -c $< -o $@
|
|
|
|
clean:
|
|
rm -f decompressor.bin decompressor.elf $(OBJ)
|