1
0
mirror of https://github.com/sgmarz/osblog.git synced 2024-11-24 10:26:20 +04:00
osblog/risc_v/userspace/startlib/Makefile

26 lines
521 B
Makefile
Raw Normal View History

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)