forked from NJU-ProjectN/nexus-am
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile.app
38 lines (28 loc) · 901 Bytes
/
Makefile.app
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
.DEFAULT_GOAL = app
include $(AM_HOME)/Makefile.check
$(info Building $(NAME) [$(ARCH)])
APP_DIR ?= $(shell pwd)
INC_DIR += $(APP_DIR)/include/
DST_DIR ?= $(APP_DIR)/build/$(ARCH)/
BINARY ?= $(APP_DIR)/build/$(NAME)-$(ARCH)
INC_DIR += $(addsuffix /include/, $(addprefix $(AM_HOME)/libs/, $(LIBS)))
$(shell mkdir -p $(DST_DIR))
LIBS += klib # link klib by default
include $(AM_HOME)/Makefile.compile
ifeq ($(ARCH), native)
LINKLIBS = $(filter-out klib, $(LIBS))
else
LINKLIBS = $(LIBS)
endif
LINK_FILES += $(AM_HOME)/am/build/am-$(ARCH).a $(OBJS)
LINK_FILES += $(addsuffix -$(ARCH).a, $(join \
$(addsuffix /build/, $(addprefix $(AM_HOME)/libs/, $(LINKLIBS))), \
$(LINKLIBS) \
))
.PHONY: app run clean
app: $(OBJS) am $(LIBS)
@bash $(AM_HOME)/am/arch/$(ARCH)/img/build $(BINARY) $(LINK_FILES)
run: app
@bash $(AM_HOME)/am/arch/$(ARCH)/img/run $(BINARY)
clean:
rm -rf $(APP_DIR)/build/