2017-05-21 21:17:11 +08:00
|
|
|
APP_DIR ?= $(shell pwd)
|
2017-05-29 17:05:36 +08:00
|
|
|
INC_DIR += $(APP_DIR)/include/
|
2017-05-21 22:10:24 +08:00
|
|
|
DST_DIR ?= $(APP_DIR)/build/$(ARCH)/
|
2019-03-22 00:32:08 +08:00
|
|
|
BINARY ?= $(APP_DIR)/build/$(NAME)-$(ARCH)
|
|
|
|
BINARY_REL = $(shell realpath $(BINARY) --relative-to .)
|
2017-05-21 21:17:11 +08:00
|
|
|
|
2019-03-23 15:50:51 +08:00
|
|
|
include $(AM_HOME)/Makefile.check
|
|
|
|
$(info # Building $(NAME) [$(ARCH)] with AM_HOME {$(AM_HOME)})
|
|
|
|
|
2019-03-22 00:32:08 +08:00
|
|
|
default: image
|
2017-08-22 23:35:03 +08:00
|
|
|
|
2019-03-22 00:32:08 +08:00
|
|
|
LIBS += klib compiler-rt
|
2017-05-29 17:05:36 +08:00
|
|
|
INC_DIR += $(addsuffix /include/, $(addprefix $(AM_HOME)/libs/, $(LIBS)))
|
|
|
|
|
2017-06-04 19:15:47 +08:00
|
|
|
include $(AM_HOME)/Makefile.compile
|
|
|
|
|
2019-05-06 17:45:53 +08:00
|
|
|
LINK_LIBS = $(sort $(LIBS))
|
2019-05-06 17:11:43 +08:00
|
|
|
LINK_FILES = \
|
|
|
|
$(OBJS) \
|
|
|
|
$(AM_HOME)/am/build/am-$(ARCH).a \
|
2019-03-22 00:32:08 +08:00
|
|
|
$(addsuffix -$(ARCH).a, $(join \
|
2019-05-06 17:11:43 +08:00
|
|
|
$(addsuffix /build/, $(addprefix $(AM_HOME)/libs/, $(LINK_LIBS))), \
|
|
|
|
$(LINK_LIBS) \
|
2017-05-29 17:05:36 +08:00
|
|
|
))
|
|
|
|
|
2019-02-17 12:23:49 +08:00
|
|
|
$(OBJS): $(PREBUILD)
|
2019-03-22 00:32:08 +08:00
|
|
|
image: $(OBJS) am $(LIBS) prompt
|
|
|
|
prompt: $(OBJS) am $(LIBS)
|
|
|
|
run: default
|
2017-05-26 20:47:00 +08:00
|
|
|
|
2019-02-17 20:12:19 +08:00
|
|
|
prompt:
|
2019-03-08 00:03:53 +08:00
|
|
|
@echo \# Creating binary image [$(ARCH)]
|
2019-02-17 20:12:19 +08:00
|
|
|
|
2017-05-21 23:22:51 +08:00
|
|
|
clean:
|
2017-05-21 21:43:53 +08:00
|
|
|
rm -rf $(APP_DIR)/build/
|
2019-03-22 00:32:08 +08:00
|
|
|
|
|
|
|
.PHONY: default run image prompt clean
|