1/* 2 * normalize local -l* library conventions 3 * 4 * L [ [ G11 ... G1n ] ... [ Gg1 ... Ggn ] ] :MAPLIB: T1.c ... Tn.c 5 * 6 * if Giji not specified then G11 == L 7 * the first Ti.c that compiles/links with group -lGi1 ... -lGin 8 * but does not compile/link with no libraries maps 9 * -lL to to require -lGi1 ... -lGin 10 * otherwise -lL is not required and maps to "no library required" 11 */ 12 13":MAPLIB:" : .MAKE .OPERATOR 14 local L P 15 L := $(<:B:O=1) 16 if ! ( P = "$(<:B:O>1)" ) 17 P := $(L) 18 end 19 $(LIBDIR)/lib/$(L) :INSTALL: $(L).req 20 eval 21 $(L).req : (CC) $$(>) 22 set - 23 r='-' 24 for i in $$(*) 25 do if $$(CC) -c $i > /dev/null 26 then g= 27 for p in $(P) - 28 do case $p in 29 -) if $$(CC) -o $$(<:B:S=.exe) $i $g > /dev/null 2>&1 30 then $$(CC) -o $$(<:B:S=.exe) $i > /dev/null 2>&1 || { 31 r="$g" 32 break 2 33 } 34 fi 35 g= 36 ;; 37 *) g="$g -l$p" 38 ;; 39 esac 40 done 41 fi 42 done 2>/dev/null 43 echo " $r" > $$(<) 44 rm -f $$(<:B:S=.exe) $$(*:B:S=$$(CC.SUFFIX.OBJECT)) 45 end 46