Changeset 2716 in /cluster/svnroot


Ignore:
Timestamp:
Oct 11, 2010 4:52:16 PM (10 years ago)
Author:
fitz
Message:

New Makefile for Life

File:
1 edited

Legend:

Unmodified
Added
Removed
  • bccd-ng/trunk/trees/home/bccd/Life/Makefile

    r2446 r2716  
    1111# Variables and Flags
    1212#
     13CFLAGS    = -O3 -ggdb -pg
     14LIBS     += -lm
     15LDFLAGS  += $(LIBS)
    1316
     17# Test for intel compilers, act accordingly
     18ifeq ($(findstring intel,$(LOADEDMODULES)),intel)
     19CC        = icc
     20OMPFLAGS  = -openmp -DOMP
     21else
    1422CC        = gcc
    15 
    16 ifdef OMP
    17 # If gcc, must have version >= 4.2
    18 CC        = gcc
    19 CFLAGS   += -fopenmp -DOMP
     23OMPFLAGS  = -fopenmp -DOMP
    2024endif
    2125
    22 # MPI must be after OMP to ensure mpicc in hybrid OMP/MPI
    23 ifdef MPI
    24 CC        = mpicc
    25 CFLAGS   += -DMPI
    26 endif
     26MPICC     = mpicc
     27MPIFLAGS  = -DMPI
    2728
    28 ifndef NO_X11
     29ifdef NO_X11
     30CFLAGS   += -DNO_X11
     31else
    2932LIBS     += -lX11
    3033LDFLAGS  += -L/usr/X11R6/lib
    31 else
    32 CFLAGS   += -DNO_X11
    3334endif
    34 
    35 LIBS     += -lm
    36 CFLAGS   +=
    37 LDFLAGS  += $(LIBS)
    3835
    3936PROGRAM   = Life
    4037SRCS      = Life.c pkit.o
    41 OBJS      = $(SRCS:.c=.o)               # object file
     38
     39# object files
     40OBJS      = $(SRCS:.c=.o)
    4241
    4342#
     
    4645
    4746default: all
     47all: serial mpi openmp hybrid
     48serial: $(SRCS) $(PROGRAM).serial
     49mpi: $(SRCS) $(PROGRAM).mpi
     50openmp: $(SRCS) $(PROGRAM).openmp
     51hybrid: $(SRCS) $(PROGRAM).hybrid
    4852
    49 all: $(PROGRAM)
     53$(PROGRAM).serial:
     54        $(CC) -o $@ $(SRCS) $(CFLAGS) $(LDFLAGS)
    5055
    51 $(PROGRAM): $(OBJS)
    52         $(CC) -o $(PROGRAM) $(SRCS) $(CFLAGS) $(LDFLAGS)
     56$(PROGRAM).mpi:
     57        $(MPICC) -o $@ $(SRCS) $(CFLAGS) $(MPIFLAGS) $(LDFLAGS)
     58
     59$(PROGRAM).openmp:
     60        $(CC) -o $@ $(SRCS) $(CFLAGS) $(OMPFLAGS) $(LDFLAGS)
     61
     62$(PROGRAM).hybrid:
     63        $(MPICC) -o $@ $(SRCS) $(CFLAGS) $(OMPFLAGS) $(MPIFLAGS) $(LDFLAGS)
    5364
    5465clean:
    55         /bin/rm -f $(OBJS) $(PROGRAM)
    56 
     66        /bin/rm -f $(OBJS) $(PROGRAM).serial $(PROGRAM).mpi $(PROGRAM).openmp $(PROGRAM).hybrid
Note: See TracChangeset for help on using the changeset viewer.