blob: 8082933d1c11704913068c755505468c04f69558 [file] [log] [blame]
Brad Bishop40a360c2016-05-28 18:41:04 -04001.DEFAULT_GOAL := all
2sbindir=/usr/sbin
Brad Bishop40a360c2016-05-28 18:41:04 -04003
4LDLIBS+=$(shell pkg-config --libs $(PACKAGE_DEPS))
Brad Bishopc034d2d2016-06-19 20:53:35 -04005ALL_CFLAGS+=$(shell pkg-config --cflags $(PACKAGE_DEPS)) -fPIC -Werror $(CFLAGS)
Brad Bishop40a360c2016-05-28 18:41:04 -04006
Brad Bishop40a360c2016-05-28 18:41:04 -04007BIN_SUFFIX?=.exe
Brad Bishop059cffb2016-08-23 10:47:19 -04008.PHONY: $(SUBDIRS)
Brad Bishop40a360c2016-05-28 18:41:04 -04009
Brad Bishop059cffb2016-08-23 10:47:19 -040010all: $(BINS:=$(BIN_SUFFIX)) $(SUBDIRS)
Brad Bishop40a360c2016-05-28 18:41:04 -040011
12%.o: %.c
Brad Bishopc034d2d2016-06-19 20:53:35 -040013 $(CC) -c $(ALL_CFLAGS) -o $@ $<
Brad Bishop40a360c2016-05-28 18:41:04 -040014
Brad Bishop059cffb2016-08-23 10:47:19 -040015$(SUBDIRS):
16 $(MAKE) -C $@
17
Brad Bishop37d0aa52016-06-27 13:35:11 -040018$(BINS:=$(BIN_SUFFIX)): %$(BIN_SUFFIX): %.o $(EXTRA_OBJS)
19 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS)
Brad Bishop40a360c2016-05-28 18:41:04 -040020
Brad Bishop37d0aa52016-06-27 13:35:11 -040021install: $(BINS:=$(BIN_SUFFIX))
Brad Bishop40a360c2016-05-28 18:41:04 -040022 @mkdir -p $(DESTDIR)$(sbindir)
Brad Bishop37d0aa52016-06-27 13:35:11 -040023 @for b in $(BINS:=$(BIN_SUFFIX)); do \
24 install $$b $(DESTDIR)$(sbindir) || exit 1; \
Brad Bishop40a360c2016-05-28 18:41:04 -040025 done
Brad Bishop059cffb2016-08-23 10:47:19 -040026 @for d in $(SUBDIRS); do \
27 $(MAKE) -C $$d $@ || exit 1; \
28 done
Brad Bishop40a360c2016-05-28 18:41:04 -040029
Brad Bishop489bf652016-06-27 13:10:05 -040030clean:
Brad Bishop40a360c2016-05-28 18:41:04 -040031 rm -rf *.o $(BINS:=$(BIN_SUFFIX))
Brad Bishop059cffb2016-08-23 10:47:19 -040032 @for d in $(SUBDIRS); do \
33 $(MAKE) -C $$d $@ || exit 1; \
34 done