summaryrefslogtreecommitdiff
path: root/Makefile
blob: a94ea25b08e34985e7ccb31d5bf3b54fd1fc1e2d (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
43
44
45
46
47
# Makefile for llmnrd
#
# Copyright (C) 2014-2015 Tobias Klauser <tklauser@distanz.ch>

P 	= llmnrd
OBJS	= llmnr.o iface.o socket.o util.o main.o
LIBS	= -lpthread

CC	= $(CROSS_COMPILE)gcc
INSTALL	= install

CFLAGS	?= -W -Wall -O2
LDFLAGS	?=

ifeq ($(DEBUG), 1)
  CFLAGS += -g -DDEBUG
endif

CCQ	= @echo "  CC $<" && $(CC)
LDQ	= @echo "  LD $@" && $(CC)

prefix	?= /usr/local

BINDIR	= $(prefix)/bin
DESTDIR	=

all: $(P)

$(P): $(OBJS)
	$(LDQ) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)

install_$(P): $(P)
	@echo "  INSTALL $(P)"
	@$(INSTALL) -d -m 755 $(DESTDIR)$(BINDIR)
	@$(INSTALL) -m 755 $(P) $(BINDIR)/$(P)

%.o: %.c %.h
	$(CCQ) $(CFLAGS) -o $@ -c $<

%.o: %.c
	$(CCQ) $(CFLAGS) -o $@ -c $<

install: install_$(P)

clean:
	@echo "  CLEAN"
	@rm -f $(OBJS) $(P)