Commit 03134342 authored by Florian Wittkamp's avatar Florian Wittkamp

Maintenance Makefiles

(1.) IFOS Makefile
Introduce dependencies files, which contain dependencied of each objective file. Therefore, it is possible to allow a more accurate rebuilt of the objective files.
New standard target is IFOS2D. Moreover a new target install is available.

(2.) Contrib
Fixed the problem with the dependencies files if the hole IFOS folder is copied over to a different hardware architecture.
You may now the error by ".d" files.
parent 09c5aa3d
......@@ -166,7 +166,9 @@ libaff.so: $(INSTHEADER) $(LIBOBS)
> $@; \
[ -s $@ ] || rm -f $@'
ifneq ($(MAKECMDGOALS),clean)
include $(patsubst %.cc,%.d,$(SRC))
endif
# this include will be used once we initiate the precompiled library version
# until then it's just waiting here
......
......@@ -200,7 +200,9 @@ libfourierxx.so: install-include libfourier.a $(LIBOBSXX)
> $@; \
[ -s $@ ] || rm -f $@'
ifneq ($(MAKECMDGOALS),clean)
include $(patsubst %.cc,%.d,$(SRC))
endif
#======================================================================
# header files
......
......@@ -113,14 +113,16 @@ SUBS=$(patsubst %.f,%.o,$(wildcard subs/*.f))
# Fortran include dependencies
%.d: %.f
echo $<: $(addprefix subs/,$(shell cat $< | egrep '^ +include' | cut -f 2 -d \' | sort | uniq)) > $@
include $(patsubst %.f,%.d,$(wildcard subs/*.f))
ifneq ($(MAKECMDGOALS),clean)
include $(patsubst %.f,%.d,$(wildcard subs/*.f))
endif
#======================================================================
$(INCINSTALLPATH)/%.h: %.h
mkdir -p $(INCINSTALLPATH)
-rm -fv $@
/bin/cp -vpd $< $@
/bin/cp -vp $< $@
.PHONY: install-include
install-include: $(INSTHEADER)
......@@ -152,7 +154,9 @@ reinstall:
# library part
# ------------
ifneq ($(MAKECMDGOALS),clean)
include $(patsubst %.c,%.d,$(CLIBSRC))
endif
libcseife.a: $(patsubst %.c,%.o,$(CLIBSRC))
libseife.a: $(SUBS)
......
......@@ -170,8 +170,10 @@ clean: ;
# library part
# ------------
ifneq ($(MAKECMDGOALS),clean)
include $(patsubst %.cc,%.d,$(LIBCCSRC) $(TESTCCSRC)) \
$(patsubst %.c,%.d,$(LIBCSRC) $(TESTCSRC))
endif
libstfinv.a: $(patsubst %.cc,%.o,$(LIBCCSRC)) \
$(patsubst %.c,%.o,$(LIBCSRC))
......
......@@ -25,10 +25,12 @@ else
$(MAKE) -C ../src/ IFOS2D
endif
.PHONY: install
install: clean IFOS2D
.PHONY: clean
clean:
rm -rf ../bin/IFOS2D
rm -rf ../bin/*
$(MAKE) -C ../contrib/aff clean
$(MAKE) -C ../contrib/fourier clean
$(MAKE) -C ../contrib/stfinv clean
......
......@@ -32,12 +32,29 @@ IFLAGS=-I./../contrib/libcseife -I./../contrib/header -I.
#SFLAGS=-L./../contrib/libcseife -L./../contrib/bin
#IFLAGS=-I./../contrib/libcseife -I./../contrib/header -I.
ifeq ($(TERM_PROGRAM),Apple_Terminal)
LFLAGS=-lm -lcseife -lstfinv -laff -lfourierxx -lfftw3 -lc++
CC=mpicc
endif
# after this line, no further editing should be necessary
# --------------------------------------------------------
.c.o:
# -------------
# pattern rules
# -------------
%.o: %.c
$(CC) $(CFLAGS) -o $@ -c $< $(IFLAGS)
$(CC) $(CFLAGS) -MM $*.c $(IFLAGS) > $*.d
SNAPMERGE_OBJ = $(SNAPMERGE_SCR:%.c=%.o)
IFOS_OBJ = $(IFOS2D:%.c=%.o)
# -------------
# Dependencies
# -------------
SNAPMERGE_SCR = \
snapmerge.c \
......@@ -54,9 +71,9 @@ IFOS2D= \
stf.c \
window_cos.c \
calc_mat_change_test.c \
calc_res.c \
calc_res.c \
calc_misfit.c \
calc_opt_step.c \
calc_opt_step.c \
calc_energy.c \
checkfd.c \
checkfd_ssg_elastic.c \
......@@ -70,7 +87,7 @@ IFOS2D= \
exchange_s.c \
exchange_p.c \
snap_ssg.c \
snap_ssg_SH.c \
snap_ssg_SH.c \
seismo_ssg.c \
surface_elastic_PML.c \
surface_acoustic_PML.c \
......@@ -83,9 +100,9 @@ IFOS2D= \
update_p_PML.c \
update_s_elastic_ssg.c \
update_s_elastic_PML.c \
update_s_elastic_PML_SH.c \
update_s_elastic_PML_SH.c \
update_s_visc_PML.c \
update_s_visc_PML_SH.c \
update_s_visc_PML_SH.c \
av_mue.c \
av_rho.c \
av_tau.c \
......@@ -102,7 +119,7 @@ IFOS2D= \
$(MODEL) \
$(MODEL_AC) \
$(MODEL_EL) \
$(MODEL_VAC) \
$(MODEL_VAC) \
matcopy.c \
matcopy_elastic.c \
matcopy_acoustic.c \
......@@ -122,10 +139,10 @@ IFOS2D= \
readmod.c \
readmod_elastic.c \
readmod_acoustic.c \
receiver.c \
receiver.c \
rd_sour.c \
read_workflow.c \
apply_workflow.c \
read_workflow.c \
apply_workflow.c \
saveseis_glob.c \
sources.c \
solvelin.c \
......@@ -150,33 +167,42 @@ IFOS2D= \
zero_fdveps_ac.c \
zero_fdveps_visc.c \
calc_envelope.c \
joint_inversion.c \
matrix_operations.c \
wolfe_condition.c \
calc_hilbert.c \
joint_inversion.c \
matrix_operations.c \
wolfe_condition.c \
calc_hilbert.c \
eprecond.c \
eprecond1.c \
zero_fdveps_viscac.c \
update_p_visc_PML.c \
matcopy_viscac.c \
prepare_update_p.c \
readmod_viscac.c \
time_window_glob.c \
create_trkill_table.c \
filter_frequencies.c
SNAPMERGE_OBJ = $(SNAPMERGE_SCR:%.c=%.o)
zero_fdveps_viscac.c \
update_p_visc_PML.c \
matcopy_viscac.c \
prepare_update_p.c \
readmod_viscac.c \
time_window_glob.c \
create_trkill_table.c \
filter_frequencies.c
# -------------
# Targes
# -------------
IFOS2D: $(IFOS_OBJ) fd.h
$(CC) $(SFLAGS) $(IFOS_OBJ) -o $(EXEC)/IFOS2D $(LFLAGS)
IFOS_OBJ = $(IFOS2D:%.c=%.o)
all: IFOS2D snapmerge
snapmerge: $(SNAPMERGE_OBJ)
$(CC) $(SFLAGS) $(SNAPMERGE_OBJ) -o ../bin/snapmerge $(LFLAGS)
IFOS2D: $(IFOS_OBJ)
$(CC) $(SFLAGS) $(IFOS_OBJ) -o $(EXEC)/IFOS2D $(LFLAGS)
.PHONY: clean
clean:
find . -name "*.d" -exec rm {} \;
find . -name "*.o" -exec rm {} \;
find . -name "*.c%" -exec rm {} \;
find . -name "*.bck" -exec rm {} \;
find ../genmod -name "*.o" -exec rm {} \;
find ../genmod -name "*.d" -exec rm {} \;
install: clean all
-include $(IFOS_OBJ:.o=.d)
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment