Brad Bishop | 40a360c | 2016-05-28 18:41:04 -0400 | [diff] [blame] | 1 | .DEFAULT_GOAL := all |
2 | sbindir=/usr/sbin | ||||
Brad Bishop | 40a360c | 2016-05-28 18:41:04 -0400 | [diff] [blame] | 3 | |
4 | LDLIBS+=$(shell pkg-config --libs $(PACKAGE_DEPS)) | ||||
Brad Bishop | c034d2d | 2016-06-19 20:53:35 -0400 | [diff] [blame] | 5 | ALL_CFLAGS+=$(shell pkg-config --cflags $(PACKAGE_DEPS)) -fPIC -Werror $(CFLAGS) |
Brad Bishop | 40a360c | 2016-05-28 18:41:04 -0400 | [diff] [blame] | 6 | |
Brad Bishop | 40a360c | 2016-05-28 18:41:04 -0400 | [diff] [blame] | 7 | BIN_SUFFIX?=.exe |
Brad Bishop | 40a360c | 2016-05-28 18:41:04 -0400 | [diff] [blame] | 8 | |
Brad Bishop | 37d0aa5 | 2016-06-27 13:35:11 -0400 | [diff] [blame] | 9 | all: $(BINS:=$(BIN_SUFFIX)) |
Brad Bishop | 40a360c | 2016-05-28 18:41:04 -0400 | [diff] [blame] | 10 | |
11 | %.o: %.c | ||||
Brad Bishop | c034d2d | 2016-06-19 20:53:35 -0400 | [diff] [blame] | 12 | $(CC) -c $(ALL_CFLAGS) -o $@ $< |
Brad Bishop | 40a360c | 2016-05-28 18:41:04 -0400 | [diff] [blame] | 13 | |
Brad Bishop | 37d0aa5 | 2016-06-27 13:35:11 -0400 | [diff] [blame] | 14 | $(BINS:=$(BIN_SUFFIX)): %$(BIN_SUFFIX): %.o $(EXTRA_OBJS) |
15 | $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS) | ||||
Brad Bishop | 40a360c | 2016-05-28 18:41:04 -0400 | [diff] [blame] | 16 | |
Brad Bishop | 37d0aa5 | 2016-06-27 13:35:11 -0400 | [diff] [blame] | 17 | install: $(BINS:=$(BIN_SUFFIX)) |
Brad Bishop | 40a360c | 2016-05-28 18:41:04 -0400 | [diff] [blame] | 18 | @mkdir -p $(DESTDIR)$(sbindir) |
Brad Bishop | 37d0aa5 | 2016-06-27 13:35:11 -0400 | [diff] [blame] | 19 | @for b in $(BINS:=$(BIN_SUFFIX)); do \ |
20 | install $$b $(DESTDIR)$(sbindir) || exit 1; \ | ||||
Brad Bishop | 40a360c | 2016-05-28 18:41:04 -0400 | [diff] [blame] | 21 | done |
22 | |||||
Brad Bishop | 489bf65 | 2016-06-27 13:10:05 -0400 | [diff] [blame] | 23 | clean: |
Brad Bishop | 40a360c | 2016-05-28 18:41:04 -0400 | [diff] [blame] | 24 | rm -rf *.o $(BINS:=$(BIN_SUFFIX)) |