SHELL = /bin/sh CC = g++ CFLAGS = -g -Wall .SUFFIXES : .o .cc .cc.o : $(CC) $(CFLAGS) -c $< # This needs updating if you decide to add more src files that the # final executable (x2c) needs. x2c: scan.o x2c.o $(CC) $(CFLAGS) -o x2c scan.o x2c.o # Here you should list dependencies for all your .cc files. # So when you introduce a new src code say, X.cc, # add "X.o : " followed by the files X depends on. x2c.o : x2c.cc scan.h scan.o : scan.cc scan.h # CAUTION: be sure you know what this command will remove before you # issue it!! # invoke via "make clean". # should also remove *.c, but won't just in case someone # has some c code in this directory clean: /bin/rm -f *.o *~ x2c core a.out *.output # just do `make remake' instead of `make clean; make' remake: clean x2c