1 #******************************************************************************#
2 #* src/libraries/libMk/Makefile *#
4 #* Copyright (C) 2018 Mochi. *#
5 #******************************************************************************#
6 #******************************************************************************#
8 #******************************************************************************#
10 CUR_DIR = libraries/libMk
31 #******************************************************************************#
33 #******************************************************************************#
35 BASE_DIR = $(shell pwd | sed -e 's/\/src\/$(subst /,\/,$(CUR_DIR))//')
37 OBJS_DIR = $(BASE_DIR)/build/objs/$(CUR_DIR)
39 DIR_LIST = $(sort $(addprefix $(OBJS_DIR)/, $(dir $(SRCS))))
42 OBJS = $(addprefix $(OBJS_DIR)/, $(SRCS:.c=.o))
45 #******************************************************************************#
47 #******************************************************************************#
50 all: $(DIR_LIST) $(OBJS_DIR)/$(LIB_NAME) Makefile
55 -rm -rf $(OBJS_DIR)/../$(LIB_NAME) $(OBJS_DIR)
58 #******************************************************************************#
60 #******************************************************************************#
67 $(OBJS_DIR)/$(LIB_NAME): $(OBJS) Makefile
69 ln -f -s $@ $(OBJS_DIR)/../$(LIB_NAME)
72 $(OBJS_DIR)/%.o: %.s Makefile
76 $(OBJS_DIR)/%.o: %.c Makefile
77 $(CC) $(CFLAGS) -o $@ -c $<
80 #******************************************************************************#