[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Extending make with guile
From: |
Laurent Pelecq |
Subject: |
Extending make with guile |
Date: |
09 Jun 2002 23:13:29 -0400 |
User-agent: |
Gnus/5.0808 (Gnus v5.8.8) Emacs/21.2 |
Hello,
I've tried to find if it was planned to extend `make' with guile. But
I've found nothing. However it seems to me that `make' is a good
candidate for that. I've attached a patch to this mail that allow to
define functions with guile. It is based on make 3.79.1.
This is not a patch that may be distributed as is. It just shows that
it's easy to do. It has several limitations:
. functions are supposed to be defined in a file makefile.scm in the
build directory. This is hardcoded in functions.c.
. Functions in `make' and `guile' must have the same name which makes
impossible to create a function called `define' or `list'.
. It uses the GH interface which is deprecated but still supported.
. Only tested under Debian GNU/Linux.
I've excluded configure from the patch to make it smaller so you
probably need to run autoconf first if you want to try it. The patch
is uuencoded, I don't know what is the prefered format on this list.
To enable guile, use: ./configure --with-guile
Here is an example. The only guile function provided by make is
make-register-function which takes as arguments the function name, the
minimum numbers of arguments and optionally the maximum.
;; makefile.scm
;;
;; With 1 argument
(define (now fmt)
(strftime fmt (localtime (current-time))))
(make-register-function "now" 1 1)
;;
;; Without arguments
(define (hostname)
(utsname:nodename (uname)))
(make-register-function "hostname" 0 0)
;;
;; With any number of arguments
(define (join-string sep . l)
(apply string-append
(cdr (apply append
(map (lambda (x) (list sep x)) l)))))
(make-register-function "join-string" 1)
# Examples of Makefile
all:
@echo Current date is $(now "%c")
@echo Host is $(hostname)
@echo Path is $(join-string :,/bin,/usr/bin,/usr/local/bin)
$ make
Current date is Sun Jun 9 22:53:10 2002
Host is raleigh
Path is /bin:/usr/bin:/usr/local/bin
Any comment is welcome.
Laurent
begin 644 make-guile.patch.gz
M'XL("`05!#T"`VUA:V4M9W5I;&4N<&address@hidden(TOYLSOZ(7B=G`D9@
MP)?$=NP)P=AA%U\.X)WD]>address@hidden@TP]DSB<address@hidden
MNNY5K0SLX5"4_)DH?13RWG)F`UF>FJ'P?'NT.3&_R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&6IS`3AH!Q*3M@([<5V0`>
MV.;(]8#5"address@hidden;\U\B21S?V=G=U]H]6Y<G%TB5X'/@R]`."97(&address@hidden:
MW4;_\J+;address@hidden,(<D7.CZ`X^>OTC))CROC3<ZR4UTHSXV"^1,(address@hidden>*
M$'XJS.PJOL)F1^2Z(address@hidden;W`OC?`>E_ZON?#F#'</5Q_20]1<A3`
M^F>VGL^Y(I-)-`!1)address@hidden"#PIWG?[61=%(,%Z>4')8C\.BYMI#/O'address@hidden
MP,='2!KYYF1)address@hidden/"@4189-D#CQD)address@hidden/JH,%)1Z9%(
M"1FSLP_&'#(B7*ORJ`,A;5)address@hidden@3X+>H&12:\XB*[%Q0IV*T$*$RW0?A($F,
MX9]DPA(C&WM3'address@hidden&>.$:&AH/];J_?AXJHGZN>?Q&_U3J=^WOMT
M$*=A\E8J=%SU`SM.YB,U>`"C(BQGS4[C`Y;5W[?:K=XG.ME)JW<.KRA.+CJB
M+B[KG5ZK<=6N=\3E50=:V81]=R5;:H1D!<.'+#>??&Z(!"A8X,8GR#SMMWQI
M23@"))>493X\+=.8\5PSL?JR2TS4*E#4*M^/$O-3Z_R4TM(A)3B&N/-M2G.\
MYRB#4FM#[.R)address@hidden)5(E6+$ANC-"LK55B>7S'OZ+%IS51:56K59+U:W*:W'5
MK<]SH`Y'*(*IM"@.H,R24[73*CK864*+H/9V0%H6(2-^FX.!K?(YY9(U"SF#
M@@N$'%RE:G9(5;G*]0#$1=\2=94)5:2OI)>&CJW(^MRO2D"T.$X"60P>FPWW
MNF+><D8ZF%DP11=HI34+*2DVE,RHKN5L&=D<B)/.4*CPE%(VI(<S)R17E2PG
MO%R6/#\7C+7/Y_#$/(*]I7""'O#(]6`V#W%)address@hidden,S=,V1'address@hidden:9(6J
M'EPJO</EOB#A;GS^L7<'Z_6Q#IF3#9E+=BR*HSX$ALH**7_&@:5(9TV?L*?^
M6VQYA#QS2GX$"N52WN$Q-CZ>5J)HBVCYH]J;.&[.3I3BL45R"(address@hidden
M)OKLCZ+4)`2*U;'SB%T4;6%$>=`CSHK-*0P,S<ZT5"(\7,J!#=GSL^H0Z3`]
MY</address@hidden,;>>/:`6*R@<0$E2H8)2.S.(<`6A&<[87H,9BCF.=^2WV80,
MWF`R"ZCMX\A0)K+/"`D4VI;F&9!.%H2JN:S<GMK#8A[RSBJFW;GL2337$(2P
M!<]88P_8(U1W8\E2(;-FWLT30Z*(N,7K,_N5YT@:>,Q?)(YC[67429<?L4P)
M34:^?=6`IUY3(%'7.N9()3>6-YG:#MDG%9F1K2:ICL*2T7J54?LS5VG,%^Z7
ME50&^4H$EF]/R0NZD!GGC`DR(^7LD"["87!Y#A-4\\BQ5=(;70,P2>0LR+:@
MUG&&$R%7/10<";3<>7'['"HQ,?VOI"`X8S"[0<(<SE3P,&.-A4DB<>Q>O>_V
M%+_Y8RUS94$<4]PB29H!/TW1H'address@hidden<[=7X5A+E)\##1\O<[BRYJ9-
MMQT31$2]T'1@'8'address@hidden)-"1.11H'(address@hidden
M1NJ<-J)'5<.!^%)R6+*OB(=Z)7L(/DK<T^!89*CD+A85'SS1G[4U';)\E'DV
M`H;(.S:2[)address@hidden)H<@0</JF0Z,address@hidden)<Q8L:?-A^8P2^9]R-5H*
M2IETQK*VQDJF.*%)*V=+DI1Q?#:X&address@hidden@/`EA_4ZU^1BK
address@hidden"address@hidden(address@hidden&I5G+T%`7&:DC41)XTAL#N3MICO#&?[W/_%-53(2
M;D2LQ^78/FU(EL][II$<D.8H(F)K^'5=5(]^J6E,]W`Z5?K^G3[26GVXGC':
MB'U?UA-`K5OSD$2Y`HLL9^XF9'$FOCE*>-1I=J_:O?R####*[81G]].CVP6Z
M47ED?'E'/04PUU*O5AYMJ:<7K;S.R/34-S=$:B'4^?21]CA'HG3IS0WSN/17
MMQ?%GX5.U,address@hidden(C<M114V^5N=/3?0A".='>BLJ%B0SM":QVD%R8
ME-6Q]_B:F![5FNX`_<TK&?&C5S+%'T>090K%W;AAU#KO]3Y=-KO]#\D5<N8D
MC"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)2<4WS)_$7Y(83OJEXA:$2^P+V!ATU5:6#7M9[*$S/X?1":XP(
MTJ7LL$(SKA=&!0/W779K%6/GC2A6=_?VC->J7M:U\3_X=42=;0)#Z_RTWVW]
M7[/?N[IL-_/]H"#HPU"QD/)'_"I5(6-NT69JST>JSA+KPT^K.DL_L>HL)56G
MHO*'JL[2WZDZU;X_L>HL_>RJ$Q1&KEA5:Q04"6RASEM5XF%15.654BA7&7AV
address@hidden<FYU<:F6/('D+/6.<F26/MKS!`^#_S+$E5?1Q8\]6$(
M]^M0=_JK&>H?DA^5"0`BF$'K[OLQ['=C%3X%_9/PW9B!)!9&address@hidden&5>,+X+H
M#VQ_!2+,QCA^"!'\3!;7`B(%T5>G7(&);Y?31&T9ZE^,B2%68DBS^D=H&<*#
MR?2I%N2F(/3#FX5/(BL!2"/\,address@hidden<D>/(address@hidden@_#.\P?1&1=8%4.L
MP/*'address@hidden()B:85;L"S*/(%:)?2P=)TW&PED88A4&!*#,.18Q`&(5
address@hidden<YV!I:9R&,10P2Q"DE*H,OE\81`:address@hidden@"2;"2&0RQ
address@hidden(V0T:P&address@hidden"JT)3BBDU1B!5<0*W!0@,NPLVHDI,0A<`4"?FUZ)2<8
M8A4O3=]-;/WO8+"'64?/^I!AA#VDY?I^!*&RV6F=-<][]?;CY_IS"<Z,GLD_
M5\>,)X(/()@FE:address@hidden)FOL=M7PXR:640/TG:7['S:(,TAR&^CU!
M3H#YK59*#><3#Y4'J?^K_'K7J-$EYIO*ME%[$W?745J[U%2YD2-1I*)#EX??
M4P7=]!"S!E(Q?Q0<address@hidden/*AS*FJ:Z<OD4%E.ZMR?OP0.>)^"L6W;AK
M$9<[U%/(M$V.P#/4,<EDNE&"25UH/9<N75ZA+EM+$R4BHKCUJEHKA\LW3:I(
M083E_TFMT_N0FBR(67WZWH]279'WIM)%"address@hidden:%0B%5E&HL
M1"^HB[F3(2VF*-7V2:'@?'6:Z0II.J8&XR\<1,#2"62R\%OZ5#&6Z4%F6!-(
M%61JXCN(?0;75+WY,QA&F-*\BADTY;X5)address@hidden,B%O.-\+T35/V'-81)&%D
MWBU=/#V(1C+,BA9F*2S^?RE7L]0V#(3/Y"G4GFSB=)P8!D).T$++M"1,`L/1
M$TR`S)0X34(Y=/KNW3_)DF4[:<L%D+2KU:XL[WZ[LE:@S4&>]!;[_A?S!88Q
M[Y0:O_(=!9-7_F`]S,?'?2HYZG?[43>.Y6%>YLM4UT"address@hidden);0/$=D
M5X"=/+20]HI$LQ,[M=ITQ'%5`F=JU$YADX#=DX]77-*@<4QH2,]'C&MCIT"!
MW'$V&GU++TP?,(..I^>4(VL=MH7*S,*'"F-7]#>/$)'V4=$HXX!SI6_/M(K]
M9:B6[?;`:address@hidden;address@hidden@Q#(address@hidden(46>/"`IDVRX+Q7/$;
address@hidden',ORL%_-/E*M_,LDV:W^,-6A7P`"9DL`Z5]NU\^/GFB]N;
M0Y_9$O<00(##SEE-L']$VDW'HX]?3L<30XBUCPL!_6#RUT73]'I?\5:JK2/8
MLL=`C%:;5:++$PPD&address@hidden<Y`RW6$>/WG*X';"Z3"P7Z^V4GDXFY^,;
M%?#B^55_37;AS12YTR&X09D+9178>.45827[X>W5V?GX.K`E!O[>`G".WHYS
MX/GVCHANAV?#3R"YL_HR$EDC4HDJ<C-:6J:$LUC-`N&/I6A\,K*7'JK?G<-`
MA?#+R]RYKHM,JWDM9F_PL!4FBNC8#$NC8,:2HJ5?"X>W855QCCD[V!P[-[ML
MY3E>)$?'*RUPNF"GQ%X!FM9A]/C=F.K\==)CD4O*"S:1LD"@:`^<address@hidden
MII&-`!+_Q<9`/M%>3"address@hidden'<";:address@hidden:@=$J2?GP!ZH(=A("FIJ
M;J(2E?W;I`+<`+FK\C+"LHT#H371?S`Q*(W/1'<UD6MTIFQTTU-/3*",IP!L
MK:<Q.$Q4LI;N:#`8H2^>O:address@hidden(6AMH"&3QB;"YGLH`*V55ZHX&4K9`
M29/-VC<(2EF3NJ.9=.VOCYKKJ00K\<BXO6&/"4!B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