# # Sample Makefile # # USAGE: # 1. Replace the a.c b.c with your source files (.c, cpp only) # 2. replace myproj with the name of the executable. # 3. In the first time and every time you add an #include statement # in your program, type "make depend" # 4. To build the program, type make. # LIBS = -lm CC = g++ CFLAGS = -g LIBRARIAN = ar LIBFLAGS = r LDFLAGS=-g SOURCES = a.c b.c OBJECTS := $(patsubst %.c,%.o,$(SOURCES)) .c.o: $(CC) -c $(CFLAGS) $< all: myproj myproj: $(OBJECTS) $(CC) $(LDFLAGS) -o $@ $(OBJECTS) clean: $(RM) *.o *~ depend: $(CC) -M $(SOURCES) > .depend -include .depend