Thursday, February 25, 2016

Saturday, February 20, 2016

My First make file which works

# Define required macros here
SHELL = /bin/sh

CFLAG = -Wall -g
CC = gfortran
INCLUDE =
LIBS = -lm

# Write program dependency and main program

SRCS = SubProg1.f90 SubProg2.f90 SubProg3.f90 SubProg4.f90 SubProg5.f90 SubProg6.f90 MainProg.f90

OBJS = $(SRCS:.c=.mod)

MAIN= MainProg

.PHONY: depend clean

all:$(MAIN)
@echo  Simple compiler named mycc has been compiled

$(MAIN): $(OBJS)
$(CC) $(CFLAGS) $(INCLUDES) -o $(MAIN) $(OBJS) $(LFLAGS) $(LIBS)

.c.o:
$(CC) $(CFLAGS) $(INCLUDES) -c $<  -o $@

clean:
$(RM) *.mod *~ $(MAIN)

depend: $(SRCS)
makedepend $(INCLUDES) $^