为什么make会重新编译此makefile中的所有内容?

时间:2019-03-09 12:39:27

标签: c makefile

我有以下makefile:

#
CC=gcc
CPLUS=g++
DIR=HypeRvieW
GTK_LIB=`pkg-config --libs gtk+-3.0` -DGL_GLEXT_PROTOTYPES -lGL -lfreetype
GTK_CFLAGS=`pkg-config --cflags gtk+-3.0`
GLIB_LIB=`pkg-config --libs glib-2.0`
GLIB_CFLAGS=`pkg-config --cflags glib-2.0`
MODULE_EXPORT_LIB=`pkg-config --libs gmodule-export-2.0`
MODULE_EXPORT_CFLAGS=`pkg-config --cflags gmodule-export-2.0`
LIBGLADE_LIB=`pkg-config --libs libglade-2.0`
LIBGLADE_CFLAGS=`pkg-config --cflags libglade-2.0`
LIBMATIO_LIB=`pkg-config --libs matio`
LIBMATIO_CFLAGS=`pkg-config --cflags matio`
FFTW3_CFLAGS=-lfftw3

all:  start_aux global_data.so librexistrado libmatlab.so libhrw.so libimg_format.so librawm.so tiff.o libelm libpca_emp libpca librqs libsvmPredict libwatershed libmajorityv_watershed libmajorityv_rqs libsmoothing libdenoising mainCopy_aux ayuda.o classification.o gtk-diagram.o gtk-plugin.o gtk-pin.o gtk-connection.o gtk-context-menu.o gtk-notification.o colors.o dialogUtils.o progressbar.o utilFunctions.o eventHelper.o renderHelper.o fileSystem.o openHelper.o saveHelper.o execute.o executeHelper.o  common_functions.o ground_truth.o histogram.o image.o interface_plugins.o main.o md5.o manage_files.o manage_plugin.o color.o editor_ground_truth.o editor_segmented_image.o menu.o signals.o window.o biophysical.o segalgths/FH.o segalgths/ETPS.o end
    $(CPLUS) -Wl,-rpath=dlib -o $(DIR)/HypeRvieW main/ayuda.o main/classification/classification.o main/classification/gtk-diagram.o main/classification/gtk-plugin.o main/classification/gtk-pin.o main/classification/gtk-connection.o main/classification/gtk-context-menu.o main/classification/gtk-notification.o main/classification/utils/colors.o main/classification/utils/dialogUtils.o main/classification/utils/progressbar.o main/classification/utils/utilFunctions.o main/classification/helpers/eventHelper.o main/classification/helpers/renderHelper.o main/classification/fileSystem/fileSystem.o main/classification/fileSystem/openHelper.o main/classification/fileSystem/saveHelper.o main/classification/execution/execute.o main/classification/execution/executeHelper.o main/common_functions.o main/ground_truth.o main/histogram.o main/image.o main/interface_plugins.o main/main.o main/md5.o tiff/tiff.o main/manage_files.o main/manage_plugin.o main/color.o main/editor_ground_truth.o segalgths/FH.o segalgths/ETPS.o main/editor_segmented_image.o main/menu.o main/signals.o main/window.o main/biophysical.o -Lmain/dlib $(GTK_LIB) $(MODULE_EXPORT_LIB) $(LIBGLADE_LIB)  $(GLIB_LIB) $(LIBMATIO_LIB) $(FFTW3_CFLAGS) -lm -lz -ldl -lglobal_data -lrawm -lmatlab -lhrw -limg_format -lglib-2.0 -lcrypto -ltiff -g

#clean:
#   rm -rf HypeRvieW
#   find -name "*.o" -exec rm {} \;
#   find -name "*.d" -exec rm {} \;
#   find -name "*.so" -exec rm {} \;
#   find -name "*.so.*" -exec rm {} \;
    #find -name "*.a" -exec xargs rm {} \;
#   rm -f main/headers/tipo_datos.h

mainCopy_aux:
    if [ ! -d "./$(DIR)" ]; then cp hrw/hrw.h main/include;     cp matlab/matlab.h main/include; cp rawm/rawm.h main/include; cp tiff/tiff.h main/include; cp img_format/img_format.h main/include; cp global_data/global_data.h main/include; mkdir -p main/dlib; cp $(DIR)/dlib/*.* main/dlib; cp database.json $(DIR); fi

#mainCopy:
#   cp hrw/hrw.h main/include
#   cp matlab/matlab.h main/include
#   cp rawm/rawm.h main/include
#   cp tiff/tiff.h main/include
#   cp img_format/img_format.h main/include
#   cp global_data/global_data.h main/include
#   mkdir -p main/dlib
#   cp $(DIR)/dlib/*.* main/dlib
#   #cp libs/*.* $(DIR)/dlib
#   cp database.json $(DIR)

ayuda.o: main/ayuda.c
    $(CC) -Wl,-rpath=dlib -c -g -I./main/include $(GTK_CFLAGS) $(MODULE_EXPORT_CFLAGS) $(LIBGLADE_CFLAGS) $(GLIB_CFLAGS) -MMD -MP -MF main/ayuda.o.d -o main/ayuda.o main/ayuda.c

#classification

classification.o: main/classification/classification.c
    cp global_data/global_data.h main/include
    $(CC) -Wl,-rpath=dlib -c -g -I./main/include $(GTK_CFLAGS) $(MODULE_EXPORT_CFLAGS) $(LIBGLADE_CFLAGS) $(GLIB_CFLAGS) -MMD -MP -MF main/classification/classification.o.d -o main/classification/classification.o main/classification/classification.c

gtk-diagram.o: main/classification/gtk-diagram.c
    $(CC) -Wl,-rpath=dlib -c -g -I./main/include $(GTK_CFLAGS) $(MODULE_EXPORT_CFLAGS) $(LIBGLADE_CFLAGS) $(GLIB_CFLAGS) -MMD -MP -MF main/classification/gtk-diagram.o.d -o main/classification/gtk-diagram.o main/classification/gtk-diagram.c

gtk-plugin.o: main/classification/gtk-plugin.c
    $(CC) -Wl,-rpath=dlib -c -g -I./main/include $(GTK_CFLAGS) $(MODULE_EXPORT_CFLAGS) $(LIBGLADE_CFLAGS) $(GLIB_CFLAGS) -MMD -MP -MF main/classification/gtk-plugin.o.d -o main/classification/gtk-plugin.o main/classification/gtk-plugin.c

gtk-pin.o: main/classification/gtk-pin.c
    $(CC) -Wl,-rpath=dlib -c -g -I./main/include $(GTK_CFLAGS) $(MODULE_EXPORT_CFLAGS) $(LIBGLADE_CFLAGS) $(GLIB_CFLAGS) -MMD -MP -MF main/classification/gtk-pin.o.d -o main/classification/gtk-pin.o main/classification/gtk-pin.c

gtk-connection.o: main/classification/gtk-connection.c
    $(CC) -Wl,-rpath=dlib -c -g -I./main/include $(GTK_CFLAGS) $(MODULE_EXPORT_CFLAGS) $(LIBGLADE_CFLAGS) $(GLIB_CFLAGS) -MMD -MP -MF main/classification/gtk-connection.o.d -o main/classification/gtk-connection.o main/classification/gtk-connection.c

gtk-context-menu.o: main/classification/gtk-context-menu.c
    $(CC) -Wl,-rpath=dlib -c -g -I./main/include $(GTK_CFLAGS) $(MODULE_EXPORT_CFLAGS) $(LIBGLADE_CFLAGS) $(GLIB_CFLAGS) -MMD -MP -MF main/classification/gtk-context-menu.o.d -o main/classification/gtk-context-menu.o main/classification/gtk-context-menu.c

gtk-notification.o: main/classification/gtk-notification.c
    $(CC) -Wl,-rpath=dlib -c -g -I./main/include $(GTK_CFLAGS) $(MODULE_EXPORT_CFLAGS) $(LIBGLADE_CFLAGS) $(GLIB_CFLAGS) -MMD -MP -MF main/classification/gtk-notification.o.d -o main/classification/gtk-notification.o main/classification/gtk-notification.c

colors.o:
    $(CC) -Wl,-rpath=dlib -c -g -I./main/include $(GTK_CFLAGS) $(MODULE_EXPORT_CFLAGS) $(LIBGLADE_CFLAGS) $(GLIB_CFLAGS) -MMD -MP -MF main/classification/utils/colors.o.d -o main/classification/utils/colors.o main/classification/utils/colors.c

dialogUtils.o: main/classification/utils/dialogUtils.c
    $(CC) -Wl,-rpath=dlib -c -g -I./main/include $(GTK_CFLAGS) $(MODULE_EXPORT_CFLAGS) $(LIBGLADE_CFLAGS) $(GLIB_CFLAGS) -MMD -MP -MF main/classification/utils/dialogUtils.o.d -o main/classification/utils/dialogUtils.o main/classification/utils/dialogUtils.c

progressbar.o: main/classification/utils/progressbar.c
    $(CC) -Wl,-rpath=dlib -c -g -I./main/include $(GTK_CFLAGS) $(MODULE_EXPORT_CFLAGS) $(LIBGLADE_CFLAGS) $(GLIB_CFLAGS) -MMD -MP -MF main/classification/utils/progressbar.o.d -o main/classification/utils/progressbar.o main/classification/utils/progressbar.c

# strings.o:
# $(CC) -Wl,-rpath=dlib -c -g -I./main/include $(GTK_CFLAGS) $(MODULE_EXPORT_CFLAGS) $(LIBGLADE_CFLAGS) $(GLIB_CFLAGS) -MMD -MP -MF main/classification/utils/strings.o.d -o main/classification/utils/strings.o main/classification/utils/strings.c
#
# styles.o:
# $(CC) -Wl,-rpath=dlib -c -g -I./main/include $(GTK_CFLAGS) $(MODULE_EXPORT_CFLAGS) $(LIBGLADE_CFLAGS) $(GLIB_CFLAGS) -MMD -MP -MF main/classification/utils/styles.o.d -o main/classification/utils/styles.o main/classification/utils/styles.c
#
# types.o:
# $(CC) -Wl,-rpath=dlib -c -g -I./main/include $(GTK_CFLAGS) $(MODULE_EXPORT_CFLAGS) $(LIBGLADE_CFLAGS) $(GLIB_CFLAGS) -MMD -MP -MF main/classification/utils/types.o.d -o main/classification/utils/types.o main/classification/utils/types.c

utilFunctions.o: main/classification/utils/utilFunctions.c
    $(CC) -Wl,-rpath=dlib -c -g -I./main/include $(GTK_CFLAGS) $(MODULE_EXPORT_CFLAGS) $(LIBGLADE_CFLAGS) $(GLIB_CFLAGS) -MMD -MP -MF main/classification/utils/utilFunctions.o.d -o main/classification/utils/utilFunctions.o main/classification/utils/utilFunctions.c

#helpers
eventHelper.o: main/classification/helpers/eventHelper.c
    $(CC) -Wl,-rpath=dlib -c -g -I./main/include $(GTK_CFLAGS) $(MODULE_EXPORT_CFLAGS) $(LIBGLADE_CFLAGS) $(GLIB_CFLAGS) -MMD -MP -MF main/classification/helpers/eventHelper.o.d -o main/classification/helpers/eventHelper.o main/classification/helpers/eventHelper.c

renderHelper.o: main/classification/helpers/renderHelper.c
    $(CC) -Wl,-rpath=dlib -c -g -I./main/include $(GTK_CFLAGS) $(MODULE_EXPORT_CFLAGS) $(LIBGLADE_CFLAGS) $(GLIB_CFLAGS) -MMD -MP -MF main/classification/helpers/renderHelper.o.d -o main/classification/helpers/renderHelper.o main/classification/helpers/renderHelper.c

#fileSystem
fileSystem.o: main/classification/fileSystem/fileSystem.c
    $(CC) -Wl,-rpath=dlib -c -g -I./main/include $(GTK_CFLAGS) $(MODULE_EXPORT_CFLAGS) $(LIBGLADE_CFLAGS) $(GLIB_CFLAGS) -MMD -MP -MF main/classification/fileSystem/fileSystem.o.d -o main/classification/fileSystem/fileSystem.o main/classification/fileSystem/fileSystem.c

openHelper.o: main/classification/fileSystem/openHelper.c
    $(CC) -Wl,-rpath=dlib -c -g -I./main/include $(GTK_CFLAGS) $(MODULE_EXPORT_CFLAGS) $(LIBGLADE_CFLAGS) $(GLIB_CFLAGS) -MMD -MP -MF main/classification/fileSystem/openHelper.o.d -o main/classification/fileSystem/openHelper.o main/classification/fileSystem/openHelper.c

saveHelper.o: main/classification/fileSystem/saveHelper.c
    $(CC) -Wl,-rpath=dlib -c -g -I./main/include $(GTK_CFLAGS) $(MODULE_EXPORT_CFLAGS) $(LIBGLADE_CFLAGS) $(GLIB_CFLAGS) -MMD -MP -MF main/classification/fileSystem/saveHelper.o.d -o main/classification/fileSystem/saveHelper.o main/classification/fileSystem/saveHelper.c

#execution
execute.o: main/classification/execution/execute.c
    $(CC) -Wl,-rpath=dlib -c -g -I./main/include $(GTK_CFLAGS) $(MODULE_EXPORT_CFLAGS) $(LIBGLADE_CFLAGS) $(GLIB_CFLAGS) -MMD -MP -MF main/classification/execution/execute.o.d -o main/classification/execution/execute.o main/classification/execution/execute.c

executeHelper.o: main/classification/execution/executeHelper.c
    $(CC) -Wl,-rpath=dlib -c -g -I./main/include $(GTK_CFLAGS) $(MODULE_EXPORT_CFLAGS) $(LIBGLADE_CFLAGS) $(GLIB_CFLAGS) -MMD -MP -MF main/classification/execution/executeHelper.o.d -o main/classification/execution/executeHelper.o main/classification/execution/executeHelper.c

# clasificacion.o:
#   cp global_data/global_data.h main/include
#   $(CC) -Wl,-rpath=dlib -c -g -I./main/include $(GTK_CFLAGS) $(MODULE_EXPORT_CFLAGS) $(LIBGLADE_CFLAGS) $(GLIB_CFLAGS) -MMD -MP -MF main/clasificacion.o.d -o main/clasificacion.o main/clasificacion.c

common_functions.o: main/common_functions.c
    $(CC) -Wl,-rpath=dlib -c -g -I./main/include $(GTK_CFLAGS) $(MODULE_EXPORT_CFLAGS) $(LIBGLADE_CFLAGS) $(GLIB_CFLAGS) -MMD -MP -MF main/common_functions.o.d -o main/common_functions.o main/common_functions.c

ground_truth.o: main/ground_truth.c
    $(CC) -Wl,-rpath=dlib -c -g -I./main/include $(GTK_CFLAGS) $(MODULE_EXPORT_CFLAGS) $(LIBGLADE_CFLAGS) $(GLIB_CFLAGS) -MMD -MP -MF main/ground_truth.o.d -o main/ground_truth.o main/ground_truth.c

histogram.o: main/histogram.c
    $(CC) -Wl,-rpath=dlib -c -g -I./main/include $(GTK_CFLAGS) $(MODULE_EXPORT_CFLAGS) $(LIBGLADE_CFLAGS) $(GLIB_CFLAGS) -MMD -MP -MF main/histogram.o.d -o main/histogram.o main/histogram.c

image.o: main/image.c
    $(CC) -Wl,-rpath=dlib -c -g -I./main/include $(GTK_CFLAGS) $(MODULE_EXPORT_CFLAGS) $(LIBGLADE_CFLAGS) $(GLIB_CFLAGS) -MMD -MP -MF main/image.o.d -o main/image.o main/image.c

interface_plugins.o: main/interface_plugins.c
    $(CC) -Wl,-rpath=dlib -c -g -I./main/include $(GTK_CFLAGS) $(MODULE_EXPORT_CFLAGS) $(LIBGLADE_CFLAGS) $(GLIB_CFLAGS) -MMD -MP -MF main/interface_plugins.o.d -o main/interface_plugins.o main/interface_plugins.c

main.o: main/main.c
    $(CC) -Wl,-rpath=dlib -c -g -I./main/include $(GTK_CFLAGS) $(MODULE_EXPORT_CFLAGS) $(LIBGLADE_CFLAGS) $(GLIB_CFLAGS) -MMD -MP -MF main/main.o.d -o main/main.o main/main.c

manage_files.o: main/manage_files.c
    $(CC) -Wl,-rpath=dlib -c -g -I./main/include $(GTK_CFLAGS) $(MODULE_EXPORT_CFLAGS) $(LIBGLADE_CFLAGS) $(GLIB_CFLAGS) -MMD -MP -MF main/manage_files.o.d -o main/manage_files.o main/manage_files.c

md5.o: main/md5.c
    $(CC) -Wl,-rpath=dlib -c -g -I./main/include $(GTK_CFLAGS) $(MODULE_EXPORT_CFLAGS) $(LIBGLADE_CFLAGS) $(GLIB_CFLAGS) -MMD -MP -MF main/md5.o.d -o main/md5.o main/md5.c

manage_plugin.o: main/manage_plugin.c
    $(CC) -Wl,-rpath=dlib -c -g -I./main/include $(GTK_CFLAGS) $(MODULE_EXPORT_CFLAGS) $(LIBGLADE_CFLAGS) $(GLIB_CFLAGS) -MMD -MP -MF main/manage_plugin.o.d -o main/manage_plugin.o main/manage_plugin.c

color.o: main/color.c
    $(CC) -Wl,-rpath=dlib -c -g -I./main/include $(GTK_CFLAGS) $(MODULE_EXPORT_CFLAGS) $(LIBGLADE_CFLAGS) $(GLIB_CFLAGS) -MMD -MP -MF main/color.o.d -o main/color.o main/color.c

editor_ground_truth.o: main/editor_ground_truth.c
    $(CC) -Wl,-rpath=dlib -c -g -I./main/include $(GTK_CFLAGS) $(MODULE_EXPORT_CFLAGS) $(LIBGLADE_CFLAGS) $(GLIB_CFLAGS) -MMD -MP -MF main/editor_ground_truth.o.d -o main/editor_ground_truth.o main/editor_ground_truth.c

editor_segmented_image.o: main/editor_segmented_image.c
    $(CC) -Wl,-rpath=dlib -c -g -I./main/include $(GTK_CFLAGS) $(MODULE_EXPORT_CFLAGS) $(LIBGLADE_CFLAGS) $(GLIB_CFLAGS) -MMD -MP -MF main/editor_segmented_image.o.d -o main/editor_segmented_image.o main/editor_segmented_image.c

menu.o: main/menu.c
    $(CC) -Wl,-rpath=dlib -c -g -I./main/include $(GTK_CFLAGS) $(MODULE_EXPORT_CFLAGS) $(LIBGLADE_CFLAGS) $(GLIB_CFLAGS) -MMD -MP -MF main/menu.o.d -o main/menu.o main/menu.c

signals.o: main/signals.c
    $(CC) -Wl,-rpath=dlib -c -g -I./main/include $(GTK_CFLAGS) $(MODULE_EXPORT_CFLAGS) $(LIBGLADE_CFLAGS) $(GLIB_CFLAGS) -MMD -MP -MF main/signals.o.d -o main/signals.o main/signals.c

window.o: main/window.c
    $(CC) -Wl,-rpath=dlib -c -g -I./main/include $(GTK_CFLAGS) $(MODULE_EXPORT_CFLAGS) $(LIBGLADE_CFLAGS) $(GLIB_CFLAGS) -MMD -MP -MF main/window.o.d -o main/window.o main/window.c

biophysical.o: main/biophysical_indexes.c
    $(CC) -Wl,-rpath=dlib -c -g -I./main/include $(GTK_CFLAGS) $(MODULE_EXPORT_CFLAGS) $(LIBGLADE_CFLAGS) $(GLIB_CFLAGS) -MMD -MP -MF main/biophysical.o.d -o main/biophysical.o main/biophysical_indexes.c

start_aux:
    if [ ! -d "./$(DIR)" ]; then mkdir -p $(DIR);   mkdir -p $(DIR)/dlib; mkdir -p $(DIR)/image; cp main/image/*.* $(DIR)/image; mkdir -p $(DIR)/image/manual; cp main/image/manual/*.* $(DIR)/image/manual; mkdir -p $(DIR)/image/icons; cp main/image/icons/*.* $(DIR)/image/icons; mkdir -p $(DIR)/plugins/; mkdir -p $(DIR)/plugins/compilados; cp -a glade/. $(DIR)/plugins; mkdir -p $(DIR)/plugins/input; mkdir -p $(DIR)/plugins/output; printf '# Ignore everything in this directory\n*\n# Except this file\n!.gitignore\n' > $(DIR)/plugins/output/.gitignore; else rm -Rf $(DIR)/plugins/es; rm -Rf $(DIR)/plugins/en; fi

#start:
#   if [ -d "./$(DIR)" ]; then rm -R $(DIR);    fi
#   mkdir -p $(DIR)
#   mkdir -p $(DIR)/dlib
#   mkdir -p $(DIR)/image
#   cp main/image/*.* $(DIR)/image
#   mkdir -p $(DIR)/image/manual
#   cp main/image/manual/*.* $(DIR)/image/manual
#   mkdir -p $(DIR)/image/icons
#   cp main/image/icons/*.* $(DIR)/image/icons
#   mkdir -p $(DIR)/plugins/
#   mkdir -p $(DIR)/plugins/compilados
#   cp -a glade/. $(DIR)/plugins
#   mkdir -p $(DIR)/plugins/input
#   mkdir -p $(DIR)/plugins/output
#   printf '# Ignore everything in this directory\n*\n# Except this file\n!.gitignore\n' > $(DIR)/plugins/output/.gitignore

    # Compilamos la librería global_data
global_data.so: global_data.o imaxes.o algoritmo.o
    $(CC) -o $(DIR)/dlib/libglobal_data.so global_data/global_data.o rexistrado/imaxes.o rexistrado/algoritmo.o $(GTK_LIB) -shared -fPIC -lfftw3

global_data.o: global_data/global_data.c
    $(CC) -c -g $(GTK_CFLAGS) -fPIC  -MMD -MP -MF global_data/global_data.o.d -o global_data/global_data.o global_data/global_data.c -lfftw3

    #Compilamos librería HRW
libhrw.so: hrw.o
    $(CC) -o $(DIR)/dlib/libhrw.so hrw/hrw.o -Ldlib $(GLIB_LIB) -L./hrw/dlib/ -lglobal_data -lz -lm -shared -fPIC

hrw.o: hrw/hrw.c
    mkdir -p hrw/dlib; cp $(DIR)/dlib/libglobal_data.so hrw/dlib/libglobal_data.so; mkdir -p hrw/include
    $(CC) -c -g -I./hrw/include $(GLIB_CFLAGS) -fPIC  -MMD -MP -MF hrw/hrw.o.d -o hrw/hrw.o hrw/hrw.c

    # Compilamos librería img_format
libimg_format.so: img_format.o
    $(CC) -o $(DIR)/dlib/libimg_format.so img_format/img_format.o -Ldlib $(GLIB_LIB) -L./img_format/dlib/ -lglobal_data -shared -fPIC

img_format.o: img_format/img_format.c
    mkdir -p img_format/dlib; cp $(DIR)/dlib/libglobal_data.so img_format/dlib/libglobal_data.so; mkdir -p img_format/include
    $(CC) -c -g -I./img_format/include $(GLIB_CFLAGS) -fPIC  -MMD -MP -MF img_format/img_format.o.d -o img_format/img_format.o img_format/img_format.c

    # Compilamos librería matlab
libmatlab.so: matlab.o
    $(CC) -o $(DIR)/dlib/libmatlab.so matlab/matlab.o -Ldlib $(GLIB_LIB) $(LIBMATIO_LIB) -L./matlab/dlib/ -lglobal_data -lm -lz -ldl -shared -fPIC

matlab.o: matlab/matlab.c
    mkdir -p matlab/dlib; cp $(DIR)/dlib/libglobal_data.so matlab/dlib/libglobal_data.so; mkdir -p matlab/include
    $(CC) -c -g -Imatlab/include $(GLIB_CFLAGS) -fPIC  -MMD -MP -MF matlab/matlab.o.d -o matlab/matlab.o matlab/matlab.c

    # Compilamos librería rawm
librawm.so: parson.o rawm.o
    $(CC) -o $(DIR)/dlib/librawm.so rawm/parson.o rawm/rawm.o -Ldlib $(GLIB_LIB)  -L./rawm/dlib/ -lglobal_data -shared -fPIC

rawm.o: rawm/rawm.c
    $(CC) -c -g -Irawm/include $(GLIB_CFLAGS) -fPIC  -MMD -MP -MF rawm/rawm.o.d -o rawm/rawm.o rawm/rawm.c

parson.o: rawm/parson.c
    mkdir -p rawm/dlib; cp $(DIR)/dlib/libglobal_data.so rawm/dlib/libglobal_data.so; mkdir -p rawm/include
    $(CC) -c -g -Irawm/include $(GLIB_CFLAGS) -fPIC  -MMD -MP -MF rawm/parson.o.d -o rawm/parson.o rawm/parson.c

    # Compilamos plugin ELM
libelm: elm_d.o libreriaFunciones.o
    $(CC) -o $(DIR)/plugins/compilados/libelm elm/elm_d.o elm/libreriaFunciones.o -Ldlib $(GTK_LIB) -L./elm/dlib/ -lglobal_data -fopenmp -L./elm/dlib/ -llapacke -llapack -lblas -lm -lgfortran -shared -fPIC

elm_d.o: elm/elm_d.c
    mkdir -p elm/dlib; cp $(DIR)/dlib/libglobal_data.so elm/dlib
    $(CC) -c -g -I. -I/usr/local/include -I/usr/lib/gcc/x86_64-linux-gnu/4.4/include -I/usr/lib/gcc/x86_64-linux-gnu/4.4/include-fixed -I/usr/include $(GTK_CFLAGS) -fPIC  -MMD -MP -MF elm/elm_d.o.d -o elm/elm_d.o elm/elm_d.c

libreriaFunciones.o: elm/libreriaFunciones.c
    $(CC) -c -g -I. -I/usr/local/include -I/usr/lib/gcc/x86_64-linux-gnu/4.4/include -I/usr/lib/gcc/x86_64-linux-gnu/4.4/include-fixed -I/usr/include $(GTK_CFLAGS) -fPIC  -MMD -MP -MF elm/libreriaFunciones.o.d -o elm/libreriaFunciones.o elm/libreriaFunciones.c

   # compilamos plugin PCA-EMP
libpca_emp: pca_emp.o
    $(CC) -o $(DIR)/plugins/compilados/libpca_emp pca_emp/pca_emp.o -Ldlib $(GTK_LIB) -L./pca_emp/dlib/ -lglobal_data -fopenmp -L./pca_emp/dlib/ -llapacke -llapack -lblas -lm -lgfortran -shared -fPIC

pca_emp.o: pca_emp/pca_emp.c
    mkdir -p pca_emp/dlib; cp $(DIR)/dlib/libglobal_data.so pca_emp/dlib
    $(CC) -c -g -I. -I/usr/local/include -I/usr/lib/gcc/x86_64-linux-gnu/4.4/include -I/usr/lib/gcc/x86_64-linux-gnu/4.4/include-fixed -I/usr/include $(GTK_CFLAGS) -fPIC  -MMD -MP -MF pca_emp/pca_emp.o.d -o pca_emp/pca_emp.o pca_emp/pca_emp.c

   # compilamos plugin PCA
libpca: pca1.o
    $(CC) -o $(DIR)/plugins/compilados/libpca pca/pca1.o -Ldlib $(GTK_LIB) -L./pca/dlib/ -lglobal_data -fopenmp -L./pca/dlib/ -llapacke -llapack -lblas -lm -lgfortran -shared -fPIC

pca1.o: pca/pca.c
    mkdir -p pca/dlib; cp $(DIR)/dlib/libglobal_data.so pca/dlib
    $(CC) -c -g -I. -I/usr/local/include -I/usr/lib/gcc/x86_64-linux-gnu/4.4/include -I/usr/lib/gcc/x86_64-linux-gnu/4.4/include-fixed -I/usr/include $(GTK_CFLAGS) -fPIC  -MMD -MP -MF pca/pca1.o.d -o pca/pca1.o pca/pca.c

    # Compilamos plugin Rexistrado
librexistrado: rexistrado_d.o imaxes.o algoritmo.o hiperspectral.o pca.o hyfm
    cp rexistrado/tipo_datos.h main/headers/
    $(CC) -Wl,-rpath=dlib -o $(DIR)/plugins/compilados/libregistration rexistrado/imaxes.o rexistrado/algoritmo.o rexistrado/hiperspectral.o rexistrado/pca.o rexistrado/pca_HYFM.o rexistrado/reg_HYFM.o rexistrado/rexistrado_d.o -Ldlib $(GTK_LIB) $(FFTW3_CFLAGS) -L./rexistrado/dlib/ -lglobal_data -fopenmp -L./rexistrado/dlib/ -llapacke -llapack -lblas -O3 -lm -Ldlib -lfftw3 -lgfortran -shared -fPIC

imaxes.o: rexistrado/imaxes.c
    $(CC) -c -g -I./ $(GTK_CFLAGS) -fPIC -MMD -MP -MF rexistrado/imaxes.o.d -o rexistrado/imaxes.o rexistrado/imaxes.c

algoritmo.o: rexistrado/algoritmo.c
    $(CC) -c -g -I./ $(GTK_CFLAGS) -fPIC -MMD -MP -MF rexistrado/algoritmo.o.d -o rexistrado/algoritmo.o rexistrado/algoritmo.c

hiperspectral.o: rexistrado/hiperspectral.c
    $(CC) -c -g -I./ $(GTK_CFLAGS) -fPIC -MMD -MP -MF rexistrado/hiperspectral.o.d -o rexistrado/hiperspectral.o rexistrado/hiperspectral.c

pca.o: rexistrado/pca.c
    $(CC) -c -g -I. -I/usr/local/include -I/usr/lib/gcc/x86_64-linux-gnu/4.4/include -I/usr/lib/gcc/x86_64-linux-gnu/4.4/include-fixed -I/usr/include $(GTK_CFLAGS) -lopenblas -O3 -fopenmp -Wl,-rpath=dlib -fPIC  -MMD -MP -MF rexistrado/pca.o.d -o rexistrado/pca.o rexistrado/pca.c

hyfm: rexistrado/pca_HYFM.c rexistrado/reg_HYFM.c
    $(CC) -c -g -I. -I/usr/local/include -I/usr/lib/gcc/x86_64-linux-gnu/4.4/include -I/usr/lib/gcc/x86_64-linux-gnu/4.4/include-fixed -I/usr/include $(GTK_CFLAGS) -lm -llapacke -lblas -lgfortran -O3 -fopenmp -Wl,-rpath=dlib -fPIC  -MMD -MP -MF rexistrado/pca_HYFM.o.d -o rexistrado/pca_HYFM.o rexistrado/pca_HYFM.c
    $(CC) -c -g -I. -I/usr/local/include -I/usr/lib/gcc/x86_64-linux-gnu/4.4/include -I/usr/lib/gcc/x86_64-linux-gnu/4.4/include-fixed -I/usr/include $(GTK_CFLAGS) -lm -O3 -Wl,-rpath=dlib -fPIC  -MMD -MP -MF rexistrado/reg_HYFM.o.d -o rexistrado/reg_HYFM.o rexistrado/reg_HYFM.c

rexistrado_d.o: rexistrado/rexistrado_d.c
    mkdir -p rexistrado/dlib; cp $(DIR)/dlib/libglobal_data.so rexistrado/dlib
    $(CC) -c -g -I. -I/usr/local/include -I/usr/lib/gcc/x86_64-linux-gnu/4.4/include -I/usr/lib/gcc/x86_64-linux-gnu/4.4/include-fixed -I/usr/include $(GTK_CFLAGS) -fPIC  -MMD -MP -MF rexistrado/rexistrado_d.o.d -o rexistrado/rexistrado_d.o rexistrado/rexistrado_d.c

    # Compilamos plugin rqs
librqs: Image.o RCMG-CPU.o quickshift_cpu.o rqs.o
    $(CPLUS) -o $(DIR)/plugins/compilados/librqs rqs/Image.o rqs/RCMG-CPU.o rqs/quickshift_cpu.o rqs/rqs.o -L./dlib $(GTK_LIB) -fopenmp -Wall -fno-strict-aliasing -DUNIX -I. -L./rqs/dlib/ -lglobal_data -shared -fPIC

Image.o: rqs/Image.cpp
    mkdir -p rqs/dlib; cp $(DIR)/dlib/libglobal_data.so rqs/dlib; cp $(DIR)/dlib/libimg_format.so rqs/dlib
    $(CPLUS) -c -g -I./ $(GTK_CFLAGS) -fPIC  -MMD -MP -MF rqs/Image.o.d -o rqs/Image.o rqs/Image.cpp

RCMG-CPU.o: rqs/RCMG-CPU.cpp
    $(CPLUS) -c -g -I./ $(GTK_CFLAGS) -fPIC  -MMD -MP -MF rqs/RCMG-CPU.o.d -o rqs/RCMG-CPU.o rqs/RCMG-CPU.cpp

quickshift_cpu.o: rqs/quickshift_cpu.cpp
    $(CPLUS) -c -g -I./ $(GTK_CFLAGS) -fPIC  -MMD -MP -MF rqs/quickshift_cpu.o.d -o rqs/quickshift_cpu.o rqs/quickshift_cpu.cpp

rqs.o: rqs/rqs.cpp
    $(CPLUS) -c -g -I./ $(GTK_CFLAGS) -fPIC  -MMD -MP -MF rqs/rqs.o.d -o rqs/rqs.o rqs/rqs.cpp

    # Compilamos plugin svm
libsvmPredict:svm-predict.o svm-train.o svm.o svmPrediction.o
    $(CPLUS) -o $(DIR)/plugins/compilados/libsvmPredict svm/svm-predict.o svm/svm-train.o svm/svm.o svm/svmPrediction.o -L./svm/dlib $(GTK_LIB) -lglobal_data -shared -fPIC

svm-predict.o: svm/svm-predict.c
    mkdir -p svm/dlib; cp $(DIR)/dlib/libglobal_data.so svm/dlib
    $(CC) -c -g -I. -I/usr/local/include -I/usr/lib/gcc/x86_64-linux-gnu/4.4/include -I/usr/lib/gcc/x86_64-linux-gnu/4.4/include-fixed -I/usr/include $(GTK_CFLAGS) -fPIC  -MMD -MP -MF svm/svm-predict.o.d -o svm/svm-predict.o svm/svm-predict.c

svm-train.o: svm/svm-train.c
    $(CC) -c -g -I. -I/usr/local/include -I/usr/lib/gcc/x86_64-linux-gnu/4.4/include -I/usr/lib/gcc/x86_64-linux-gnu/4.4/include-fixed -I/usr/include $(GTK_CFLAGS) -fPIC  -MMD -MP -MF svm/svm-train.o.d -o svm/svm-train.o svm/svm-train.c

svm.o: svm/svm.cpp
    $(CPLUS) -c -g -I. $(GTK_CFLAGS) -fPIC  -MMD -MP -MF svm/svm.o.d -o svm/svm.o svm/svm.cpp

svmPrediction.o: svm/svmPrediction.cpp
    $(CPLUS) -c -g -I. $(GTK_CFLAGS) -fPIC  -MMD -MP -MF svm/svmPrediction.o.d -o svm/svmPrediction.o svm/svmPrediction.cpp

    # Compilamos plugin watershed
libwatershed:CA-WSHED.o RCMG-CPU1.o watershed.o
    $(CPLUS) -o $(DIR)/plugins/compilados/libwatershed watershed/CA-WSHED.o watershed/RCMG-CPU.o watershed/watershed.o -Lwatershed/dlib $(GTK_LIB) -fopenmp -lglobal_data -shared -fPIC

CA-WSHED.o: watershed/CA-WSHED.cpp
    mkdir -p watershed/dlib; cp $(DIR)/dlib/libglobal_data.so watershed/dlib; cp $(DIR)/dlib/libimg_format.so watershed/dlib
    $(CPLUS) -c -g -I./ $(GTK_CFLAGS) -fPIC  -MMD -MP -MF watershed/CA-WSHED.o.d -o watershed/CA-WSHED.o watershed/CA-WSHED.cpp

RCMG-CPU1.o: watershed/RCMG-CPU.cpp
    $(CPLUS) -c -g -I./ $(GTK_CFLAGS) -fPIC  -MMD -MP -MF watershed/RCMG-CPU.o.d -o watershed/RCMG-CPU.o watershed/RCMG-CPU.cpp

watershed.o: watershed/watershed.c
    $(CC) -c -g $(GTK_CFLAGS) -fPIC  -MMD -MP -MF watershed/watershed.o.d -o watershed/watershed.o watershed/watershed.c

    # Compilamos el plugin majority voting watershed
libmajorityv_watershed:majorityVoteWatershed.o
    $(CC) -o $(DIR)/plugins/compilados/libmajorityv_watershed mv_w/majorityVoteWatershed.o -L./mv_w/dlib $(GK_LIB) -fopenmp -lglobal_data -shared -fPIC

majorityVoteWatershed.o: mv_w/majorityVoteWatershed.c
    mkdir -p mv_w/dlib; cp $(DIR)/dlib/libglobal_data.so mv_w/dlib; cp $(DIR)/dlib/libimg_format.so mv_w/dlib
    $(CC) -c -g $(GTK_CFLAGS) -fPIC  -MMD -MP -MF mv_w/majorityVoteWatershed.o.d -o mv_w/majorityVoteWatershed.o mv_w/majorityVoteWatershed.c

    # Compilamos el plugin Smoothing
libsmoothing:smoothing.o
    $(CC) -o $(DIR)/plugins/compilados/libsmoothing smoothing/smoothing.o -L./smoothing/dlib $(GK_LIB) -fopenmp -lglobal_data -shared -fPIC

smoothing.o: smoothing/smoothing.c
    mkdir -p smoothing/dlib; cp $(DIR)/dlib/libglobal_data.so smoothing/dlib
    $(CC) -c -g $(GTK_CFLAGS) -fPIC  -MMD -MP -MF smoothing/smoothing.o.d -o smoothing/smoothing.o smoothing/smoothing.c

    # Compilamos el plugin Denoising
libdenoising:denoising.o
    $(CPLUS) -o $(DIR)/plugins/compilados/libdenoising denoising/denoising.o -L./denoising/dlib $(GK_LIB) -fopenmp -lglobal_data -shared -fPIC

denoising.o: denoising/denoising.cpp
    mkdir -p denoising/dlib; cp $(DIR)/dlib/libglobal_data.so denoising/dlib
    $(CPLUS) -c -g $(GTK_CFLAGS) -fPIC  -MMD -MP -MF denoising/denoising.o.d -o denoising/denoising.o denoising/denoising.cpp


    # Compilamos el plugin majority voting RQS
libmajorityv_rqs:majorityVoteRQS.o
    $(CC) -o $(DIR)/plugins/compilados/libmajorityv_rqs mv_rqs/majorityVoteRQS.o -L./mv_rqs/dlib $(GK_LIB) -fopenmp -lglobal_data -shared -fPIC

majorityVoteRQS.o: mv_rqs/majorityVoteRQS.c
    mkdir -p mv_rqs/dlib; cp $(DIR)/dlib/libglobal_data.so mv_rqs/dlib; cp $(DIR)/dlib/libimg_format.so mv_rqs/dlib
    $(CC) -c -g $(GTK_CFLAGS) -fPIC  -MMD -MP -MF mv_rqs/majorityVoteRQS.o.d -o mv_rqs/majorityVoteRQS.o mv_rqs/majorityVoteRQS.c

# Compiles TIFF library
tiff.o: tiff/tiff.c
    $(CC) -Wl,-rpath=dlib -c -g -I./main/include $(GLIB_CFLAGS) -ltiff -o tiff/tiff.o tiff/tiff.c

end:
    cp -a $(DIR)/plugins/compilados/. $(DIR)/plugins/es
    cp -a $(DIR)/plugins/compilados/. $(DIR)/plugins/en

我放置了几个依赖关系,以强制使make仅在文件更改后才进行编译。但是make每次运行时都会编译所有内容。 有没有一种方法可以修改它,使其仅编译已修改的文件? 即使没有任何更改,运行make也会始终触发完全重新编译。这些文件都没有更改,为什么要这样做?

1 个答案:

答案 0 :(得分:1)

是的。做到这一点的方法是遵循second rule of makefiles

您的规则说您将构建一个gtk-connection.o之类的文件。但是您规则中的食谱实际 要做的是建立一个main/classification/gtk-connection.o之类的文件。您没有说出要实现的事实,因此,下次运行make时,它会查看文件gtk-connection.o是否存在,并且从未存在,因此make始终决定重建它。

您需要更改规则的目标以反映要构建的实际文件,或者必须更改配方来构建告诉您要构建的文件。

通常,您确实应该尝试利用make的功能来简化makefile,例如模式规则,自动变量等。