-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
46 lines (34 loc) · 1.18 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
44
45
46
BINDIR = bin
OBJDIR = obj
SRCDIR = src
TARGET ?= $(BINDIR)/todd
DAILYBOT?= $(BINDIR)/dailybot
SRCS = $(wildcard $(SRCDIR)/*.c)
_SRCS = $(notdir $(SRCS))
_OBJS = $(_SRCS:.c=.o)
OBJS = $(addprefix $(OBJDIR)/, $(_OBJS))
LIBS = -lzmq -lpq -lncursesw
INCPATHS = -I/usr/include/postgresql -I./include
REVID = $(shell git describe --always --dirty=*)
CC ?= gcc
CFLAGS ?= -Wall -Wextra -Wno-unused-parameter -g -std=gnu99 -DREVID="\"$(REVID)\""
PREFIX = /usr/local
-include Makefile.config
all: $(BINDIR) $(OBJDIR) $(TARGET) $(DAILYBOT)
$(BINDIR):
mkdir -p $(BINDIR)
$(OBJDIR):
mkdir -p $(OBJDIR)
$(TARGET): $(OBJS)
$(CC) $(CFLAGS) -o $@ $^ $(LIBS)
$(OBJDIR)/%.o: $(SRCDIR)/%.c $(wildcard include/*.h) Makefile
$(CC) $(CFLAGS) $(INCPATHS) -o $@ -c $<
$(DAILYBOT): dailybot/dailybot.c $(OBJDIR)/database.o $(OBJDIR)/globals.o
gcc $(CFLAGS) $(INCPATHS) $(LIBS) -o $@ dailybot/dailybot.c $(OBJDIR)/database.o $(OBJDIR)/globals.o
clean:
rm $(OBJS) $(TARGET) $(DAILYBOT) || true
test -d obj && rmdir obj || true
test -d bin && rmdir bin || true
install: $(TARGET) $(DAILYBOT)
install -D $(TARGET) $(DESTDIR)$(PREFIX)/bin/
install -D $(DAILYBOT) $(DESTDIR)$(PREFIX)/bin/