nexus-am/Makefile.lib

27 lines
695 B
Makefile
Raw Normal View History

2017-05-21 23:22:51 +08:00
include $(AM_HOME)/Makefile.check
$(info # Building lib-$(NAME) [$(ARCH)])
2017-05-21 23:22:51 +08:00
LIB_DIR ?= $(shell pwd)
INC_DIR += $(LIB_DIR)/include/
DST_DIR ?= $(LIB_DIR)/build/$(ARCH)/
ARCHIVE ?= $(LIB_DIR)/build/$(NAME)-$(ARCH).a
2019-06-14 03:04:24 +08:00
## Default: Build a linkable archive (.a)
2019-03-21 17:32:08 +08:00
default: $(ARCHIVE)
2017-05-29 17:05:36 +08:00
INC_DIR += $(addsuffix /include/, $(addprefix $(AM_HOME)/libs/, $(LIBS)))
2019-03-22 00:32:08 +08:00
CFLAGS += -fdata-sections -ffunction-sections -fno-builtin
2017-05-21 23:22:51 +08:00
2019-06-14 03:04:24 +08:00
## Paste in "Makefile.compile" here
2017-05-21 23:22:51 +08:00
include $(AM_HOME)/Makefile.compile
2019-06-14 03:04:24 +08:00
## Compliation rule for objects -> .a (using ar)
$(ARCHIVE): $(OBJS)
@echo + AR "->" $(shell realpath $@ --relative-to .)
@ar rcs $(ARCHIVE) $(OBJS)
2017-05-21 23:22:51 +08:00
clean:
rm -rf $(LIB_DIR)/build/
2019-03-22 00:32:08 +08:00
.PHONY: default clean