-
Notifications
You must be signed in to change notification settings - Fork 57
/
Makefile
43 lines (36 loc) · 1.04 KB
/
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
32
33
34
35
36
37
38
39
40
41
42
43
####
#### Generic Makefile only for C projects
####
#### This file is public domain.
#### J. Camilo Gomez C.
####
include build_options.mk
###################################################################################################
### Do NOT touch the lines below , use the build_options.mk file to change the compile behavior ###
###################################################################################################
INC := $(sort -I. $(addprefix -I./,$(dir $(wildcard *.h */*.h */*/*.h */*/*/*.h) )) )
SRC := $(wildcard src/**/*.c)
OBJ := $(addprefix $(OBJ_DIR)/,$(SRC:.c=$(OBJ_EXT)))
OUT = $(BIN_DIR)/$(notdir $(CURDIR))
.SUFFIXES:
.PHONY: all clean show rebuild
$(OUT): $(OBJ)
@mkdir -p $(dir $@)
$(LD) $^ $(LFLAGS) -o $@
size $(OUT)
$(OBJ_DIR)/%$(OBJ_EXT): %.c
@mkdir -p $(dir $@)
$(CC) $(CFLAGS) $(INC) -c $< -o $@
rebuild:
$(MAKE) clean
$(MAKE) all
all: $(OUT)
run: $(OUT)
@./$(OUT)
test: run
clean:
@$(RM) -rf $(OUT) $(OBJ_DIR) $(BIN_DIR)
show:
@echo INC = $(INC)
@echo SRC = $(SRC)
-include $(OBJ:.o=.d)