blob: c7075c1a89b71697ab657d06a5347ef6260216bf [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
Brad Bishopb408ac02016-06-20 10:00:32 -04006includedir=/usr/include
Brad Bishop40a360c2016-05-28 18:41:04 -04007
8LDLIBS+=$(shell pkg-config --libs $(PACKAGE_DEPS))
Brad Bishopc034d2d2016-06-19 20:53:35 -04009ALL_CFLAGS+=$(shell pkg-config --cflags $(PACKAGE_DEPS)) -fPIC -Werror $(CFLAGS)
Brad Bishop40a360c2016-05-28 18:41:04 -040010
11INSTALLDEPS?=install-bins
12BIN_SUFFIX?=.exe
13DEFAULT_ALL?=$(BINS)
14
15all: $(DEFAULT_ALL)
16
17%.o: %.c
Brad Bishopc034d2d2016-06-19 20:53:35 -040018 $(CC) -c $(ALL_CFLAGS) -o $@ $<
Brad Bishop40a360c2016-05-28 18:41:04 -040019
20$(BINS): %: %.o $(EXTRA_OBJS)
Brad Bishopc034d2d2016-06-19 20:53:35 -040021 $(CC) $(CFLAGS) $(LDFLAGS) -o $@$(BIN_SUFFIX) $^ $(LDLIBS)
Brad Bishop40a360c2016-05-28 18:41:04 -040022
Patrick Williamsdf417fd2016-06-21 15:08:45 -050023install-bins: $(BINS)
Brad Bishop40a360c2016-05-28 18:41:04 -040024 @mkdir -p $(DESTDIR)$(sbindir)
25 @for b in $(BINS); do \
26 install $$b$(BIN_SUFFIX) $(DESTDIR)$(sbindir) || exit 1; \
27 done
28
29install: all $(INSTALLDEPS)
30
31clean: $(CLEANDEPS)
32 rm -rf *.o $(BINS:=$(BIN_SUFFIX))