GNUmakefile 634 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
CC 		= gcc

CFLAGS 		= -Wall
LFLAGS		= -pthread -lpq -lm

INC_DIR		= ../inc
OBJ_DIR		= ../obj
BIN_DIR		= ../bin
SRC_DIR		= .

INCLUDES 	= -I/usr/include/postgresql \
		  -I$(INC_DIR)

TARGET 		= $(BIN_DIR)/gateway
15
#OBJS		= $(wildcard $(OBJ_DIR)/*.o)
16
#
17
18
SRCS		= $(wildcard $(SRC_DIR)/*.c)
OBJS		= $(patsubst $(SRC_DIR)%.c, $(OBJ_DIR)%.o, $(SRCS))
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#


$(TARGET) : $(OBJS)
	$(CC) $(CFLAGS) $(INCLUDES) $(OBJS) -o $(TARGET) $(LFLAGS)

$(OBJ_DIR)/%.o : $(SRC_DIR)/%.c
	$(CC) -c -MD $(CFLAGS) $(INCLUDES) $< -o $@

-include $(OBJ_DIR)/*.d


.PHONY: clean print

clean :
	rm -f $(BIN_DIR)/* $(OBJ_DIR)/*

print :
	$(info $$OBJS is [${OBJS}])