#Implicite Pattern Rule for Library Members changed in order to use # -I include option LOCLIB = libutil.a CC :=g++ CC_SOURCE := $(wildcard *.cc) OBJECT := $(CC_SOURCE:.cc=.o) MKFILES := $(CC_SOURCE:.cc=.d) CPPFLAGS := -O -fno-rtti -fno-exceptions -fguiding-decls tutorials := harray-tutorial.o hstring-tutorial.o hnamedlist-tutorial.o hvector-tutorial.o OBJECTS =$(filter-out $(tutorials), $(OBJECT)) lib: $(LOCLIB) @echo ' ' @echo '$(LOCLIB) successfully created' # Include a dependency Makefile *.d for each cc-file, containing the # the included header files. # This makefile is updated, whenever one of the included header files # is changed by the pattern rule (%d: %.cc) below. # If it doesn't exist, it will be created. include $(MKFILES) %.d: %.cc @$(SHELL) -ec '$(CC) -M $(CPPFLAGS) \ $< |sed '\''s/$*.o/& $@/g'\'' > $@' @echo creating Makefile $*.d @echo $(LIBDIR) (%.o): %.cc %.d $(CC) $(CPPFLAGS) -c $< -o $% $(AR) rv $@ $% $(RM) $% ranlib $(LOCLIB) %.o: %.cc %.d $(CC) $(CPPFLAGS) -c $< -o $@ $(LOCLIB): $(LOCLIB)($(OBJECTS)) @echo " " harray-tutorial: harray-tutorial.o $(LOCLIB)($(OBJECTS)) $(mkfiles) $(CC) -o harray-tutorial harray-tutorial.o -L. -lutil hstring-tutorial: hstring-tutorial.o $(LOCLIB)($(OBJECTS)) $(mkfiles) $(CC) -o hstring-tutorial hstring-tutorial.o -L. -lutil hnamedlist-tutorial: hnamedlist-tutorial.o $(LOCLIB)($(OBJECTS)) $(mkfiles) $(CC) -o hnamedlist-tutorial hnamedlist-tutorial.o -L. -lutil hvector-tutorial: hvector-tutorial.o $(LOCLIB)($(OBJECTS)) $(mkfiles) $(CC) -o hvector-tutorial hvector-tutorial.o -L. -lutil CLEAN: rm *.bak *~ *.d *.o