Avoid rebuilding CBLAS library and examples
authorKyle Guinn <elyk03@gmail.com>
Mon, 23 Jan 2017 01:39:13 +0000 (19:39 -0600)
committerKyle Guinn <elyk03@gmail.com>
Mon, 23 Jan 2017 01:39:13 +0000 (19:39 -0600)
Use targets that are actual filenames so that make can determine if the
target is already up-to-date.

Since $(CBLASLIB) is a relative path, delete it from a Makefile at the
right depth.

.gitignore
CBLAS/Makefile
CBLAS/examples/Makefile
CBLAS/src/Makefile

index 051cb7d..1e3c726 100644 (file)
@@ -11,6 +11,17 @@ make.inc
 BLAS/TESTING/*.out
 BLAS/TESTING/x*
 
+# CBLAS
+CBLAS/include/cblas_mangling.h
+
+# CBLAS testing
+CBLAS/testing/*.out
+CBLAS/testing/x*
+
+# CBLAS examples
+CBLAS/examples/cblas_ex1
+CBLAS/examples/cblas_ex2
+
 # LAPACK testing
 TESTING/x*
 TESTING/*.out
index 5a398f8..3ba1f71 100644 (file)
@@ -14,8 +14,8 @@ cleanexe:
        cd testing && $(MAKE) cleanexe
 
 cleanall: clean cleanexe
-       rm -f $(CBLASLIB)
-       cd examples && rm -f *.o cblas_ex1 cblas_ex2
+       cd src && $(MAKE) cleanall
+       cd examples && $(MAKE) cleanall
 
 cblas_testing:
        cd testing && $(MAKE) all
index 1d416a8..ded5ed9 100644 (file)
@@ -1,14 +1,14 @@
 include ../../make.inc
 
-all: example1 example2
+all: cblas_ex1 cblas_ex2
 
-example1:
-       $(CC) $(CFLAGS) -I../include -c cblas_example1.c
-       $(LOADER) $(LOADOPTS) -o cblas_ex1 cblas_example1.o $(CBLASLIB) $(BLASLIB)
-
-example2:
-       $(CC) $(CFLAGS) -I../include -c cblas_example2.c
-       $(LOADER) $(LOADOPTS) -o cblas_ex2 cblas_example2.o $(CBLASLIB) $(BLASLIB)
+cblas_ex1: cblas_example1.o
+       $(LOADER) $(LOADOPTS) -o $@ cblas_example1.o $(CBLASLIB) $(BLASLIB)
+cblas_ex2: cblas_example2.o
+       $(LOADER) $(LOADOPTS) -o $@ cblas_example2.o $(CBLASLIB) $(BLASLIB)
 
 cleanall:
        rm -f *.o cblas_ex1 cblas_ex2
+
+.c.o:
+       $(CC) $(CFLAGS) -I../include -c -o $@ $<
index 1fa91b2..660c620 100644 (file)
@@ -2,10 +2,7 @@
 
 include ../../make.inc
 
-all: cblaslib
-
-clean:
-       rm -f *.o a.out core
+all: $(CBLASLIB)
 
 # Error handling routines for level 2 & 3
 errhand = cblas_globals.o cblas_xerbla.o xerbla.o
@@ -185,13 +182,18 @@ all3: $(alev3) $(errhand)
        $(RANLIB) $(CBLASLIB)
 
 # All levels and precisions
-cblaslib: $(alev1) $(alev2) $(alev3) $(errhand)
-       $(ARCH) $(ARCHFLAGS) $(CBLASLIB) $(alev1) $(alev2) $(alev3) $(errhand)
-       $(RANLIB) $(CBLASLIB)
+$(CBLASLIB): $(alev1) $(alev2) $(alev3) $(errhand)
+       $(ARCH) $(ARCHFLAGS) $@ $(alev1) $(alev2) $(alev3) $(errhand)
+       $(RANLIB) $@
 
 FRC:
        @FRC=$(FRC)
 
+clean:
+       rm -f *.o a.out core
+cleanall:
+       rm -f $(CBLASLIB)
+
 .c.o:
        $(CC) $(CFLAGS) -I../include -c -o $@ $<