1include ../config.mk 2include ../config.in 3 4Q=@ 5 6CWARN= -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wchar-subscripts -Wcomment -Wformat=2 -Wno-format-extra-args -Wimplicit-int -Werror-implicit-function-declaration -Wmain -Wmissing-braces -Wparentheses -Wswitch -Wundef -Wshadow -Wwrite-strings 7 8CFLAGS=$(CWARN) -std=gnu99 -MMD -O2 -g 9 10SRCS=zeroconf.c delay.c 11 12OBJS= $(SRCS:.c=.o) 13 14TARGET=zeroconf 15 16all: $(TARGET) 17 18install: 19 install $(TARGET) $(TARGETDIR)/usr/sbin/ 20 $(STRIP) $(TARGETDIR)/usr/sbin/$(TARGET) 21 22clean: 23 rm -f $(TARGET) $(OBJS) *.d 24 25zeroconf: zeroconf.o delay.o 26 $(Q)echo "Creating $@" 27 $(Q)$(CC) $(CFLAGS) -o $@ $^ $(LIBS) 28 29 30# Automatic dependency generation 31# make the 'deps' variable equal to all *.c files 32# and replace the '*.c' with '*.d' in the file name 33# 34deps := ${patsubst %.c,%.d,${wildcard *.c}} 35 36# Make '*.d' dependant on '*.c' and specify how to 37# invoke the compiler to turn one ('*.c') into another ('*.d') 38${deps}: %.d : %.c 39 $(Q)$(CC) -MM $(INCLUDES) $< > $@ 40 41ifneq (${MAKECMDGOALS},clean) 42-include ${deps} 43endif 44 45# replace the inbuilt compilation rule so we get nice output 46%.o: %.c 47 $(Q)echo "Compiling $<" 48 $(Q)$(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@ 49