Thread overview | ||||||
---|---|---|---|---|---|---|
|
June 20, 2019 make C is scriptable like D | ||||
---|---|---|---|---|
| ||||
hi there, a funny thing: -------------------------------- $ cat rgcc #!/bin/sh cf=$@ mycf=__`echo $cf|xargs basename` cat $cf | sed '1d' > ${mycf} gcc ${mycf} -o a.out rm ${mycf} ./a.out $ cat test.c #!/home/user/rgcc #include <stdio.h> int main() { printf("hello\n"); } -------------------------------- And then, ---------------- chmod +x test.c ./test.c ---------------- output hello. is rdmd implemented similarly? thanks! ---- binghoo |
June 20, 2019 Re: make C is scriptable like D | ||||
---|---|---|---|---|
| ||||
Posted in reply to dangbinghoo | On Thursday, 20 June 2019 at 06:20:17 UTC, dangbinghoo wrote:
> hi there,
>
> a funny thing:
>
> --------------------------------
> $ cat rgcc
> #!/bin/sh
> cf=$@
> mycf=__`echo $cf|xargs basename`
> cat $cf | sed '1d' > ${mycf}
> gcc ${mycf} -o a.out
> rm ${mycf}
> ./a.out
>
> $ cat test.c
> #!/home/user/rgcc
> #include <stdio.h>
> int main()
> {
> printf("hello\n");
> }
> --------------------------------
>
> And then,
>
> ----------------
> chmod +x test.c
> ./test.c
> ----------------
>
> output hello.
>
> is rdmd implemented similarly?
>
> thanks!
>
> ----
> binghoo
Basically, yeah.
|
June 20, 2019 Re: make C is scriptable like D | ||||
---|---|---|---|---|
| ||||
Posted in reply to dangbinghoo | On Thursday, 20 June 2019 at 06:20:17 UTC, dangbinghoo wrote:
> hi there,
>
> a funny thing:
>
> --------------------------------
> $ cat rgcc
> #!/bin/sh
> cf=$@
> mycf=__`echo $cf|xargs basename`
> cat $cf | sed '1d' > ${mycf}
> gcc ${mycf} -o a.out
> rm ${mycf}
> ./a.out
>
> $ cat test.c
> #!/home/user/rgcc
> #include <stdio.h>
> int main()
> {
> printf("hello\n");
> }
> --------------------------------
>
> And then,
>
> ----------------
> chmod +x test.c
> ./test.c
> ----------------
>
> output hello.
>
> is rdmd implemented similarly?
>
> thanks!
>
> ----
> binghoo
rdmd adds a few different features as well, but the bigger thing it does is cache the results in a global temporary directory. So If you run rdmd on the same file with the same options twice, the second time it won't compile anything, it will detect that it was already compiled and just run it.
|
June 21, 2019 Re: make C is scriptable like D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan Marler | On Thursday, 20 June 2019 at 16:55:01 UTC, Jonathan Marler wrote:
> On Thursday, 20 June 2019 at 06:20:17 UTC, dangbinghoo wrote:
>> [...]
>
> rdmd adds a few different features as well, but the bigger thing it does is cache the results in a global temporary directory. So If you run rdmd on the same file with the same options twice, the second time it won't compile anything, it will detect that it was already compiled and just run it.
great! thanks.
|
Copyright © 1999-2021 by the D Language Foundation