PROG = hdfcompressor LIB = libhdfcompressor.a CXX_SOURCES = HDFCompressor hdfcompress SRC = $(CXX_SOURCES:=.cpp) OBJ = $(CXX_SOURCES:=.o) INC = -I$(PWD) -I$(HDF_INC) LIBS = -L$(HDF_LIBDIR) $(HDF_LIBS) #--------- Suffixes .SUFFIXES: .o .cpp .cpp.o: $(CXX) $(CXXFLAGS) $(INC) -c -o $@ $< .PHONY: default all clean default: $(OBJ) $(LIB) $(PROG) clean: rm -rf $(PROG) $(LIB) $(OBJ) all: make clean ; make $(LIB): $(OBJS) ar $(ARFLAGS) $@ $? $(PROG): $(OBJS) $(CXX) $(CXXFLAGS) $(OBJ) $(LIBS) -o $@