1TOP := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))) 2 3.DEFAULT_GOAL := all 4sbindir=/usr/sbin 5libdir=/usr/lib 6includedir=/usr/include 7 8LDLIBS+=$(shell pkg-config --libs $(PACKAGE_DEPS)) 9ALL_CFLAGS+=$(shell pkg-config --cflags $(PACKAGE_DEPS)) -fPIC -Werror $(CFLAGS) 10 11INSTALLDEPS?=install-bins 12BIN_SUFFIX?=.exe 13DEFAULT_ALL?=$(BINS) 14 15all: $(DEFAULT_ALL) 16 17%.o: %.c 18 $(CC) -c $(ALL_CFLAGS) -o $@ $< 19 20$(BINS): %: %.o $(EXTRA_OBJS) 21 $(CC) $(CFLAGS) $(LDFLAGS) -o $@$(BIN_SUFFIX) $^ $(LDLIBS) 22 23install-bins: $(BINS) 24 @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)) 33