Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds support for compiling ASM files in an application library. #491

Merged
merged 1 commit into from
Dec 23, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions etc/applib.mk
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ exist := $(wildcard sources)
ifneq ($(strip $(exist)),)
include sources
else
FULLPATHASMSRCS := $(wildcard $(VPATH)/*.S)
FULLPATHCSRCS = $(wildcard $(VPATH)/*.c)
FULLPATHCXXSRCS = $(wildcard $(VPATH)/*.cxx)
FULLPATHCPPSRCS = $(wildcard $(VPATH)/*.cpp)
ASMSRCS = $(notdir $(FULLPATHASMSRCS)) $(wildcard *.S)
CSRCS = $(notdir $(FULLPATHCSRCS))
CXXSRCS = $(notdir $(FULLPATHCXXSRCS))
CPPSRCS = $(notdir $(FULLPATHCPPSRCS))
Expand All @@ -33,7 +35,7 @@ ifdef APP_PATH
INCLUDES += -I$(APP_PATH)
endif

OBJS = $(CXXSRCS:.cxx=.o) $(CPPSRCS:.cpp=.o) $(CSRCS:.c=.o)
OBJS = $(CXXSRCS:.cxx=.o) $(CPPSRCS:.cpp=.o) $(CSRCS:.c=.o) $(ASMSRCS:.S=.o)
LIBNAME = lib$(BASENAME).a

ifdef BOARD
Expand All @@ -56,7 +58,7 @@ all: $(LIBNAME)
-include $(OBJS:.o=.d)

.SUFFIXES:
.SUFFIXES: .o .c .cxx .cpp
.SUFFIXES: .o .c .cxx .cpp .S

.cpp.o:
$(CXX) $(CXXFLAGS) $< -o $@
Expand All @@ -70,6 +72,9 @@ all: $(LIBNAME)
$(CC) $(CFLAGS) $< -o $@
$(CC) -MM $(CFLAGS) $< > $*.d

.S.o:
$(AS) $(ASFLAGS) -MD -MF $*.d $(abspath $<) -o $@

$(LIBNAME): $(OBJS)
$(AR) cr $(LIBNAME) $(OBJS)
mkdir -p ../lib
Expand Down