--- Makefile~ +++ Makefile @@ -1,4 +1,6 @@ # Comments: a sample makefile +AR = ar +RANLIB = ranlib CC = g++ CFLAGS = -g3 INCLUDES = -I. @@ -6,12 +8,19 @@ #LIBS = -lm SOURCES := $(wildcard *.cpp) OBJS := $(patsubst %.cpp,%.o, $(SOURCES)) +all: Sample library Sample: $(OBJS) $(CC) -o xecho $(CFLAGS) $(OBJS) $(LIBS) %.o: %.cpp file.h $(CC) -c $(CFLAGS) $(INCLUDES) -o $@ $< +library: libxstunt.a libxstunt.so +libxstunt.a: Client.o + $(AR) cr libxstunt.a Client.o + $(RANLIB) libxstunt.a +libxstunt.so: Client.o + $(CC) -shared -o libxstunt.so Client.o clean: - rm -f *.o + rm -f *.o *.a *.so realclean: rm -f xecho *.o