################################################## # Makefile: example C program # This example program has the following structure: # - source files in the directory src/ : # main.c (driver) io.c timing.c math.c # - header files in src/ : # toe.h # - object files should go into obj/ # - the program name is 'toe' # - it uses LAPACK routines in the SCS library # - a check for correctness is done running 'toe -test input.dat' ################################################## # $Id$ # $Source$ ################################################## CC := icc CFLAGS := -g -O2 # As of ProPack5, SGI dropped support for SCSL, so # for the BLAS, LAPACK, etc routines we use Intel MKL instead # LIBS := -lscs LIBS := -lmkl_lapack -lmkl -lguide -lpthread # optional - directories for sources and objects SRCDIR := src OBJDIR := obj # additional source file(s) without suffix CFILES = io timing math OBJFILES = $(CFILES:%=%.o) HEADERS = toe # name of your program(s) PROGRAMS = toe # program driver source file toe = main bin2 = # rules all : $(PROGRAMS) toe: $(CFILES:%=$(OBJDIR)/%.o) $(toe:%=$(OBJDIR)/%.o) $(CC) $(CFLAGS) -I$(SRCDIR) $^ -o $@ $(LIBS) bin2: $(CFILES:%=$(OBJDIR)/%.o) $(bin2:%=$(OBJDIR)/%.o) $(CC) $(CFLAGS) -I$(SRCDIR) $^ -o $@ $(LIBS) test: toe toe -test input.dat $(OBJDIR)/%.o: $(SRCDIR)/%.c $(HEADERS:%=$(SRCDIR)/%.h) $(CC) $(CFLAGS) -I$(SRCDIR) -c $< -o $@ clean: rm -f $(OBJDIR)/*.o $(PROGRAMS)