blob: 9cad8cfa91e379259799b05e736912b17a9a1992 [file] [log] [blame]
Brad Bishop40a360c2016-05-28 18:41:04 -04001TOP := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
2
3.DEFAULT_GOAL := all
4sbindir=/usr/sbin
5libdir=/usr/lib
6
7LDLIBS+=$(shell pkg-config --libs $(PACKAGE_DEPS))
8CFLAGS+=$(shell pkg-config --cflags $(PACKAGE_DEPS)) -Werror
9
10INSTALLDEPS?=install-bins
11BIN_SUFFIX?=.exe
12DEFAULT_ALL?=$(BINS)
13
14all: $(DEFAULT_ALL)
15
16%.o: %.c
17 $(CC) -c $(CFLAGS) -fPIC -o $@ $<
18
19$(BINS): %: %.o $(EXTRA_OBJS)
20 $(CC) $(LDFLAGS) -o $@$(BIN_SUFFIX) $^ $(LDLIBS)
21
22install-bins:
23 @mkdir -p $(DESTDIR)$(sbindir)
24 @for b in $(BINS); do \
25 install $$b$(BIN_SUFFIX) $(DESTDIR)$(sbindir) || exit 1; \
26 done
27
28install: all $(INSTALLDEPS)
29
30clean: $(CLEANDEPS)
31 rm -rf *.o $(BINS:=$(BIN_SUFFIX))