#! /usr/bin/make -f # # # LIBSRC = a.c b.c SOURCES = c.c TESTPROG= hello LIBNAME = libtest CFLAGS := -Wall -Wshadow -Wsign-compare \ -Wno-write-strings -Wno-conversion -Waggregate-return \ -Wstrict-prototypes -Wno-missing-prototypes \ -Wno-missing-declarations -Wredundant-decls \ -Wnested-externs -Winline \ $(CFLAGS) LDFLAGS = -L. -static -ltest all: $(LIBNAME).a $(TESTPROG) @+printf "[%s]\n" $@ $(LIBNAME).a: $(LIBNAME).a($(LIBSRC:.c=.o)) @+printf "[%s]\n" $@ ranlib $@ $(TESTPROG): $(SOURCES) @+printf "[%s]\n" $@ $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) clean: @+printf "[%s]\n" $@ $(RM) $(LIBNAME).a $(TESTPROG) distclean: clean @+printf "[%s]\n" $@ $(RM) *~ *.o *.i .PHONY: all clean distclean