refactor makefile architecture

This commit is contained in:
Yanyan Jiang 2017-05-29 17:05:36 +08:00
parent 60c3444ed8
commit d49ed6d406
4 changed files with 20 additions and 5 deletions

View File

@ -7,7 +7,9 @@ AM_HOME ?= $(shell pwd)
all:
@cd am && make ARCH=$(ARCH)
@cd libs/klib && make ARCH=$(ARCH)
@cd libs/imgui && make ARCH=$(ARCH)
clean:
@cd am && make clean
@cd libs/klib && make clean
@cd libs/imgui && make clean

View File

@ -4,20 +4,30 @@ $(info Building $(NAME) [$(ARCH)])
include $(AM_HOME)/Makefile.check
APP_DIR ?= $(shell pwd)
INC_DIR += $(APP_DIR)/include/ $(AM_HOME)/libs/klib/
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))
include $(AM_HOME)/Makefile.compile
LINK_FILES += $(AM_HOME)/am/build/am-$(ARCH).a $(OBJS)
ifneq ($(ARCH), native)
LINK_FILES += $(AM_HOME)/libs/klib/build/klib-$(ARCH).a
ifeq ($(ARCH), native)
LINKLIBS = $(filter-out klib, $(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) \
))
#ifneq ($(ARCH), native)
#LINK_FILES += $(AM_HOME)/libs/klib/build/klib-$(ARCH).a
#endif
.PHONY: app run clean
app: $(OBJS)
@cd $(AM_HOME) && make ARCH=$(ARCH)

View File

@ -8,6 +8,8 @@ INC_DIR += $(LIB_DIR)/include/
DST_DIR ?= $(LIB_DIR)/build/$(ARCH)/
ARCHIVE ?= $(LIB_DIR)/build/$(NAME)-$(ARCH).a
INC_DIR += $(addsuffix /include/, $(addprefix $(AM_HOME)/libs/, $(LIBS)))
$(shell mkdir -p $(DST_DIR))
include $(AM_HOME)/Makefile.compile

View File

@ -1,3 +1,4 @@
NAME = typing
SRCS = game.c draw.c font.c keyboard.c
LIBS = klib
include $(AM_HOME)/Makefile.app