summaryrefslogtreecommitdiff
path: root/Makefile
blob: 4978e494d90098e3866ff08933a7d865e9e6540c (plain)
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
CC := gcc

CFLAGS := -O2 -ggdb -Wall -Wextra -Wno-unused-parameter -ansi -std=c99
LDFLAGS := -Wl,--no-undefined

override CFLAGS += -D_GNU_SOURCE

GIO_CFLAGS := $(shell pkg-config --cflags gio-2.0)
GIO_LIBS := -lgio-2.0 -lgobject-2.0 -lglib-2.0

all:

# pretty print
ifndef V
QUIET_CC    = @echo '   CC         '$@;
QUIET_LINK  = @echo '   LINK       '$@;
QUIET_CLEAN = @echo '   CLEAN      '$@;
endif

test: test.o pn_core.o pn_session.o pn_node.o \
	pn_trans.o pn_cmd_node.o pn_ns.o \
	pn_log.o pn_printf.o
test: override CFLAGS += $(GIO_CFLAGS)
test: override LIBS += $(GIO_LIBS)

bins += test

all: $(bins)

$(bins):
	$(QUIET_LINK)$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)

%.so::
	$(QUIET_LINK)$(CC) $(LDFLAGS) -shared -o $@ $^ $(LIBS)

clean:
	$(QUIET_CLEAN)$(RM) $(bins) *.o *.d

%.o:: %.c
	$(QUIET_CC)$(CC) $(CFLAGS) -MMD -o $@ -c $<

-include *.d