mirror of
https://github.com/sgmarz/osblog.git
synced 2024-11-24 10:26:20 +04:00
26 lines
515 B
Makefile
26 lines
515 B
Makefile
|
CROSS=riscv64-unknown-elf-
|
||
|
CXX=g++
|
||
|
OBJCOPY=objcopy
|
||
|
AR=ar
|
||
|
CXXFLAGS=-Wall -O0 -ffreestanding -nostartfiles -nostdlib -I. -march=rv64g -mabi=lp64d
|
||
|
OUT=libstart.a
|
||
|
SOURCES_S=$(wildcard *.S)
|
||
|
SOURCES_CPP=$(wildcard *.cpp)
|
||
|
OBJS=$(patsubst %.S,%.o,$(SOURCES_S)) $(patsubst %.cpp,%.o,$(SOURCES_CPP))
|
||
|
all: $(OUT)
|
||
|
|
||
|
$(OUT): $(OBJS) Makefile
|
||
|
rm -f $(OUT)
|
||
|
$(AR) rcv $(OUT) $(OBJS)
|
||
|
|
||
|
%.o: %.S
|
||
|
$(CROSS)$(CXX) $(CXXFLAGS) -c $< -o $@
|
||
|
|
||
|
%.o: %.cpp
|
||
|
$(CROSS)$(CXX) $(CXXFLAGS) -c $< -o $@
|
||
|
|
||
|
.PHONY: clean
|
||
|
|
||
|
clean:
|
||
|
rm -f $(OUT) $(OBJS)
|