mirror of
https://github.com/sgmarz/osblog.git
synced 2024-11-24 10:26:20 +04:00
24 lines
596 B
Makefile
24 lines
596 B
Makefile
CROSS=riscv64-unknown-linux-gnu-
|
|
CXX=g++
|
|
OBJCOPY=objcopy
|
|
CXXFLAGS=-Wall -O3 -ffreestanding -nostartfiles -nostdlib -static -march=rv64gc -mabi=lp64d
|
|
LINKER_SCRIPT=-T./startlib/linker.lds
|
|
INCLUDES=-I./startlib
|
|
LIBS=-L./startlib
|
|
LIB=-lstart
|
|
SOURCES=$(wildcard *.cpp)
|
|
OUT=$(patsubst %.cpp,%.elf,$(SOURCES))
|
|
PROGS=$(patsubst %.cpp,%,$(SOURCES))
|
|
|
|
all: $(OUT)
|
|
|
|
%.elf:%.cpp Makefile startlib/linker.lds startlib/*.h
|
|
$(CROSS)$(CXX) $(CXXFLAGS) $(INCLUDES) $(LIBS) -o $@ $< $(LIB)
|
|
$(CROSS)$(OBJCOPY) -O binary $@ $@.bin
|
|
mv $@.bin $(basename $@)
|
|
|
|
clean:
|
|
rm -f $(OUT)
|
|
rm -f *.bin *.elf
|
|
rm -f $(PROGS)
|