Skip to content

Commit 814795f

Browse files
committed
Protect against undefined make variables
1 parent 8e1e16c commit 814795f

File tree

3 files changed

+84
-31
lines changed

3 files changed

+84
-31
lines changed

LAPACKE/src/Makefile

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2474,7 +2474,21 @@ endif
24742474
.PHONY: all
24752475
all: $(LAPACKELIB)
24762476

2477-
$(LAPACKELIB): $(OBJ) $(OBJ_S) $(OBJ_C) $(OBJ_D) $(OBJ_Z) $(DEPRECATED) $(EXTENDED) $(MATGEN)
2477+
LAPACKELIB_DEPS := $(OBJ) $(OBJ_S) $(OBJ_C) $(OBJ_D) $(OBJ_Z)
2478+
2479+
ifdef BUILD_DEPRECATED
2480+
LAPACKELIB_DEPS += $(DEPRECATED)
2481+
endif
2482+
2483+
ifdef USEXBLAS
2484+
LAPACKELIB_DEPS += $(EXTENDED)
2485+
endif
2486+
2487+
ifdef LAPACKE_WITH_TMG
2488+
LAPACKELIB_DEPS += $(MATGEN)
2489+
endif
2490+
2491+
$(LAPACKELIB): $(LAPACKELIB_DEPS)
24782492
$(AR) $(ARFLAGS) $@ $(OBJ)
24792493
$(AR) $(ARFLAGS) $@ $(OBJ_S)
24802494
$(AR) $(ARFLAGS) $@ $(OBJ_C)
@@ -2483,7 +2497,7 @@ $(LAPACKELIB): $(OBJ) $(OBJ_S) $(OBJ_C) $(OBJ_D) $(OBJ_Z) $(DEPRECATED) $(EXTEND
24832497
ifdef BUILD_DEPRECATED
24842498
$(AR) $(ARFLAGS) $@ $(DEPRECATED)
24852499
endif
2486-
ifdef (USEXBLAS)
2500+
ifdef USEXBLAS
24872501
$(AR) $(ARFLAGS) $@ $(EXTENDED)
24882502
endif
24892503
ifdef LAPACKE_WITH_TMG

SRC/Makefile

Lines changed: 58 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -528,45 +528,82 @@ endif
528528
.PHONY: all
529529
all: $(LAPACKLIB)
530530

531-
$(LAPACKLIB): $(ALLOBJ) $(ALLXOBJ) $(DEPRECATED)
531+
LAPACKLIB_DEPS := $(ALLOBJ)
532+
533+
ifdef USEXBLAS
534+
LAPACKLIB_DEPS += $(ALLXOBJ)
535+
endif
536+
537+
ifdef BUILD_DEPRECATED
538+
LAPACKLIB_DEPS += $(DEPRECATED)
539+
endif
540+
541+
$(LAPACKLIB): $(LAPACKLIB_DEPS)
532542
$(AR) $(ARFLAGS) $@ $^
533543
$(RANLIB) $@
534544

535545
.PHONY: single complex double complex16
536-
single: $(SLASRC) $(DSLASRC) $(SXLASRC) $(SCLAUX) $(ALLAUX)
537-
$(AR) $(ARFLAGS) $(LAPACKLIB) $^
538-
$(RANLIB) $(LAPACKLIB)
539546

540-
complex: $(CLASRC) $(ZCLASRC) $(CXLASRC) $(SCLAUX) $(ALLAUX)
547+
SINGLE_DEPS := $(SLASRC) $(DSLASRC)
548+
ifdef USEXBLAS
549+
SINGLE_DEPS += $(SXLASRC)
550+
endif
551+
SINGLE_DEPS += $(SCLAUX) $(ALLAUX)
552+
553+
single: $(SINGLE_DEPS)
541554
$(AR) $(ARFLAGS) $(LAPACKLIB) $^
542555
$(RANLIB) $(LAPACKLIB)
543556

544-
double: $(DLASRC) $(DSLASRC) $(DXLASRC) $(DZLAUX) $(ALLAUX)
557+
COMPLEX_DEPS := $(CLASRC) $(ZCLASRC)
558+
ifdef USEXBLAS
559+
COMPLEX_DEPS += $(CXLASRC)
560+
endif
561+
COMPLEX_DEPS += $(SCLAUX) $(ALLAUX)
562+
563+
complex: $(COMPLEX_DEPS)
545564
$(AR) $(ARFLAGS) $(LAPACKLIB) $^
546565
$(RANLIB) $(LAPACKLIB)
547566

548-
complex16: $(ZLASRC) $(ZCLASRC) $(ZXLASRC) $(DZLAUX) $(ALLAUX)
567+
DOUBLE_DEPS := $(DLASRC) $(DSLASRC)
568+
ifdef USEXBLAS
569+
DOUBLE_DEPS += $(DXLASRC)
570+
endif
571+
DOUBLE_DEPS += $(DZLAUX) $(ALLAUX)
572+
573+
double: $(DOUBLE_DEPS)
549574
$(AR) $(ARFLAGS) $(LAPACKLIB) $^
550575
$(RANLIB) $(LAPACKLIB)
551576

552-
$(ALLAUX): $(FRC)
553-
$(SCLAUX): $(FRC)
554-
$(DZLAUX): $(FRC)
555-
$(SLASRC): $(FRC)
556-
$(CLASRC): $(FRC)
557-
$(DLASRC): $(FRC)
558-
$(ZLASRC): $(FRC)
559-
$(ZCLASRC): $(FRC)
560-
$(DSLASRC): $(FRC)
577+
COMPLEX16_DEPS := $(ZLASRC) $(ZCLASRC)
561578
ifdef USEXBLAS
562-
$(SXLASRC): $(FRC)
563-
$(CXLASRC): $(FRC)
564-
$(DXLASRC): $(FRC)
565-
$(ZXLASRC): $(FRC)
579+
COMPLEX16_DEPS += $(ZXLASRC)
566580
endif
581+
COMPLEX16_DEPS += $(DZLAUX) $(ALLAUX)
567582

568-
FRC:
583+
complex16: $(COMPLEX16_DEPS)
584+
$(AR) $(ARFLAGS) $(LAPACKLIB) $^
585+
$(RANLIB) $(LAPACKLIB)
586+
587+
ifdef FRC
588+
$(ALLAUX): $(FRC)
589+
$(SCLAUX): $(FRC)
590+
$(DZLAUX): $(FRC)
591+
$(SLASRC): $(FRC)
592+
$(CLASRC): $(FRC)
593+
$(DLASRC): $(FRC)
594+
$(ZLASRC): $(FRC)
595+
$(ZCLASRC): $(FRC)
596+
$(DSLASRC): $(FRC)
597+
ifdef USEXBLAS
598+
$(SXLASRC): $(FRC)
599+
$(CXLASRC): $(FRC)
600+
$(DXLASRC): $(FRC)
601+
$(ZXLASRC): $(FRC)
602+
endif
603+
604+
FRC:
569605
@FRC=$(FRC)
606+
endif
570607

571608
.PHONY: clean cleanobj cleanlib
572609
clean: cleanobj cleanlib

TESTING/MATGEN/Makefile

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,17 @@ complex16: $(ZMATGEN) $(DZATGEN)
8080
$(AR) $(ARFLAGS) $(TMGLIB) $^
8181
$(RANLIB) $(TMGLIB)
8282

83-
$(SCATGEN): $(FRC)
84-
$(SMATGEN): $(FRC)
85-
$(CMATGEN): $(FRC)
86-
$(DZATGEN): $(FRC)
87-
$(DMATGEN): $(FRC)
88-
$(ZMATGEN): $(FRC)
89-
90-
FRC:
83+
ifdef FRC
84+
$(SCATGEN): $(FRC)
85+
$(SMATGEN): $(FRC)
86+
$(CMATGEN): $(FRC)
87+
$(DZATGEN): $(FRC)
88+
$(DMATGEN): $(FRC)
89+
$(ZMATGEN): $(FRC)
90+
91+
FRC:
9192
@FRC=$(FRC)
93+
endif
9294

9395
.PHONY: clean cleanobj cleanlib
9496
clean: cleanobj cleanlib

0 commit comments

Comments
 (0)