forked from cese-ids/cese-ids-16co-tp5b
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
31 lines (24 loc) · 816 Bytes
/
makefile
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
SRC_DIR = ./src
INC_DIR = ./inc
OBJ_DIR = ./build/obj
BIN_DIR = ./build
SRC_FILES = $(wildcard $(SRC_DIR)/*.c)
OBJ_FILES = $(patsubst $(SRC_DIR)%.c,$(OBJ_DIR)%.o,$(SRC_FILES))
all: build_folders $(OBJ_FILES)
@echo Building aplication
@gcc $(OBJ_FILES) -o $(BIN_DIR)/app.out
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c
@echo Compiling source file $(notdir $(basename $<))
@gcc -c $< -I$(INC_DIR) -o $@
###############################################################################
# Creation of output folders
build_folders: $(BIN_DIR) $(LIB_DIR) $(OBJ_DIR) $(DOC_DIR) $(DPN_DIR) $(RST_DIR)
$(OUT_DIR):
@echo Creating output root folder
@mkdir $(OUT_DIR)
$(BIN_DIR): $(OUT_DIR)
@echo Creating output binaries folder
@mkdir $(BIN_DIR)
$(OBJ_DIR): $(OUT_DIR)
@echo Creating output objects folder
@mkdir $(OBJ_DIR)