-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
32 lines (24 loc) · 919 Bytes
/
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
CC := g++
SRCDIR := src
BUILDDIR := obj
# CFLAGS := -g -std=c++11 -Wall -Wextra -pedantic -fdiagnostics-color=auto -Wno-unused-parameter
# LDFLAGS := -g
CFLAGS := -Os -march=native -std=c++11 -Wall -Wextra -pedantic -fdiagnostics-color=auto -Wno-unused-parameter
LDFLAGS := -Os -march=native
TARGET := galleryd
SRCEXT := cpp
SOURCES := $(shell find $(SRCDIR) -name *.$(SRCEXT))
OBJECTS := $(patsubst $(SRCDIR)/%,$(BUILDDIR)/%,$(SOURCES:.$(SRCEXT)=.o))
DEPS := $(OBJECTS:.o=.deps)
LIBS := libmicrohttpd yajl sqlite3
CFLAGS := $(CFLAGS) $(shell pkg-config --cflags $(LIBS))
LDFLAGS := $(LDFLAGS) $(shell pkg-config --libs $(LIBS))
$(TARGET): $(OBJECTS)
$(CC) $(CFLAGS) $(LDFLAGS) $^ -o $(TARGET)
$(BUILDDIR)/%.o: $(SRCDIR)/%.$(SRCEXT)
@mkdir -p $(BUILDDIR)
$(CC) $(CFLAGS) -MD -MF $(@:.o=.deps) -c -o $@ $<
clean:
$(RM) -r $(BUILDDIR)/* $(TARGET)
-include $(DEPS)
.PHONY: clean