-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
41 lines (29 loc) · 952 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
33
34
35
36
37
38
39
40
41
###
# general configuration of the makefile itself
###
SHELL := /bin/bash
.DEFAULT_GOAL := help
.PHONY: help
help:
@mh -f $(MAKEFILE_LIST) $(target) || echo "Please install mh from https://github.com/oz123/mh/releases"
ifndef target
@(which mh > /dev/null 2>&1 && echo -e "\nUse \`make help target=foo\` to learn more about foo.")
endif
CC = gcc
CFLAGS = -Wall -Wextra -g $(shell pkg-config --cflags glib-2.0 gio-2.0 ldns)
LDFLAGS = $(shell pkg-config --libs gio-2.0 ldns)
VERSION ?= $(shell git describe --always) #? version
SRCDIR = src
OBJDIR = obj
$(OBJDIR):
mkdir -p $@
SOURCES = $(SRCDIR)/main.c $(SRCDIR)/handler.c
OBJECTS = $(SOURCES:$(SRCDIR)/%.c=$(OBJDIR)/%.o)
$(TARGET): $(OBJECTS)
$(CC) $(OBJECTS) -o $@ $(LDFLAGS)
$(OBJDIR)/%.o: $(SRCDIR)/%.c | $(OBJDIR)
$(CC) $(CFLAGS) -c $< -o $@
wizdns: $(OBJDIR) $(OBJECTS) ## build wizdns
$(CC) $(OBJECTS) $(LDFLAGS) -o $@
clean: ## clean build artifacts
rm -rf $(OBJDIR) wizdns