NAME = gauss CC = g++ CFLAGS = -O LFLAGS = -O SRC = $(wildcard *.cc) # collect source file names OBJ = $(patsubst %.cc,%.o,$(SRC)) # create object file names IN = $(wildcard *.in) # collect input file names OUT = $(patsubst %.in,%.out,$(IN)) # create output file names TEX = $(wildcard *.tex) # collect tex file names PDF = $(patsubst %.tex,%.pdf,$(TEX)) all: makefile $(OUT) $(PDF) $(NAME): $(OBJ) # make the executable $(CC) -o $(NAME) $(LFLAGS) $(OBJ) %.o:%.cc # compile source $(CC) $(CFLAGS) -c $< indent -br $< clean: # remove unneded files rm -f $(NAME) rm -f *.o rm -f *.ps rm -f $(NAME).*.out rm -f *.bak rm -f *.pdf rm -f *.log %.out:%.in $(NAME) # run executable with all the input files ./$(NAME) < $< > $@ cat $@ %.pdf:%.tex # tex the project description pdftex $< makefile: $(SRC) # this will automatically create the dependencies makedepend $(SRC) &> /dev/null # DO NOT DELETE