mirror of
https://github.com/sgmarz/osblog.git
synced 2024-11-23 18:06:20 +04:00
26 lines
521 B
Makefile
26 lines
521 B
Makefile
CROSS=riscv64-unknown-linux-gnu-
|
|
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)
|