- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
Latest commit
32 lines (24 loc) · 602 Bytes
/
Copy pathmakefile
File metadata and controls
32 lines (24 loc) · 602 Bytes
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
DIR_SRC := ./src
DIR_INC := ./inc
DIR_LIB := ./lib
DIR_OBJ := ./obj
TARGET := $(DIR_OBJ)/example.out
CC := gcc
CFLAGS := -I $(DIR_INC)
SRC := $(wildcard$(DIR_SRC)/*.c)
OBJ := $(patsubst%.c, $(DIR_OBJ)/%.o, $(notdir$(SRC)))
$(TARGET) : $(OBJ)
$(CC)$^ -o $@
$(DIR_OBJ)/%.o : $(DIR_SRC)/%.c
$(CC) -c $<$(CFLAGS) -o $@
.PHONY : debug
.PHONY : clean
.PHONY : lib
lib :
$(CC) -fPIC -shared $(DIR_SRC)/queue.c $(CFLAGS) -o $(DIR_LIB)/libqueue.so
ar crv $(DIR_LIB)/libqueue.a $(DIR_OBJ)/queue.o
debug :
@echo SRC = $(SRC)
@echo OBJ = $(OBJ)
clean :
-rm $(TARGET)$(DIR_OBJ)/*$(DIR_LIB)/*