1TOP := $(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)) 32