Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #163050
| From | Keith Thompson <Keith.S.Thompson+u@gmail.com> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: Universal Build System for C |
| Date | 2021-10-08 14:22 -0700 |
| Organization | None to speak of |
| Message-ID | <87wnmn5hzk.fsf@nosuchdomain.example.com> (permalink) |
| References | (1 earlier) <sjktuo$p7l$1@dont-email.me> <32f93050-eff2-4960-b4c8-d3dd3075b31en@googlegroups.com> <4a46c648-4897-4b28-a3fc-242583460506n@googlegroups.com> <87h7ds7v8u.fsf@nosuchdomain.example.com> <18a56158-6c16-4c04-807e-74dfde2fd15an@googlegroups.com> |
Thiago Adams <thiago.adams@gmail.com> writes:
> On Thursday, October 7, 2021 at 11:41:30 AM UTC-3, Keith Thompson wrote:
>> Thiago Adams <thiago...@gmail.com> writes:
>> > On Thursday, October 7, 2021 at 10:18:13 AM UTC-3, Thiago Adams wrote:
>> >> On Wednesday, October 6, 2021 at 4:38:07 PM UTC-3, Bart wrote:
>> >> > On 04/10/2021 13:33, Thiago Adams wrote:
>> >> > >
>> >> > > In 2020 we had a topic here talking about build systems.
>> >> > > https://groups.google.com/g/comp.lang.c/c/pkn6Iw3V0pc/m/0Cn_oqi5BgAJ
>> >> > >
>> >> > > Let's say I want to publish a lib/executable with source.
>> >> > >
>> >> > > This are the instructions:
>> >> > >
>> >> > > For windows:
>> >> > >
>> >> > > Open VC++ command prompt and type.
>> >> > >
>> >> > > cl build.c & build
>> >> > This is even neater than I thought it would be.
>> >> >
>> >> > However, shouldn't & be &&? (&& won't run build if the compile fails; &
>> >> > might still do so.)
>> >> && is much better thanks!
>> >> and && works in Linux and Windows in the same way.
>> >
>> > We can also delete the build executable at the end like this
>> >
>> > WINDOWS:
>> > cl build.c && build.exe || del build.exe
>> >
>> > LINUX
>> > gcc build.c -o build && ./build || rm build
>> Normally if the compilation fails the executable won't be created. If
>> you're concerned about a pre-existing executable, you can remove it
>> before compiling. (And consider the behavior of the del or rm command
>> if it's asked to delete a file that doesn't exist.)
>>
>
> We can use:
>
> WINDOWS
> cl build.c && build & del /q build.exe
>
> LINUX
> gcc build.c -o build && ./build ; rm -f build
>
> In this case, at end the build, the executable is always deleted
> if present and no error printed.
>
> temporary files like build.obj can be deleted inside
> build.exe.
> But it cannot delete itself at the end. Right?
>
> I found this "Here is the code in C which will delete the executable after execution."
> https://unix.stackexchange.com/questions/280067/have-rm-not-report-when-a-file-is-missing
Deleting the executable after running it once is certainly valid, but
not something you'd usually want to do.
If you use a Makefile rather than a hypothetical "universal build
system", typing "make clean" will delete any files that can be
regenerated, and "make build" will recreate the file "build" only if it
doesn't exist or has been invalidated (for example if "build.c" has been
modified more recently than "build"). (Determining what depends on what
can be tricky.)
A universal build system should at least provide most of the
functionality provided by existing ones. If it can only build from
scratch, it's less useful.
--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for Philips
void Void(void) { Void(); } /* The recursive call of the void */
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Universal Build System for C Thiago Adams <thiago.adams@gmail.com> - 2021-10-04 05:33 -0700
Re: Universal Build System for C Branimir Maksimovic <branimir.maksimovic@icloud.com> - 2021-10-04 15:54 +0000
Re: Universal Build System for C fir <profesor.fir@gmail.com> - 2021-10-04 09:26 -0700
Re: Universal Build System for C fir <profesor.fir@gmail.com> - 2021-10-04 09:47 -0700
Re: Universal Build System for C fir <profesor.fir@gmail.com> - 2021-10-04 10:13 -0700
Re: Universal Build System for C fir <profesor.fir@gmail.com> - 2021-10-05 04:12 -0700
Re: Universal Build System for C Guillaume <message@bottle.org> - 2021-10-04 19:49 +0200
Re: Universal Build System for C Thiago Adams <thiago.adams@gmail.com> - 2021-10-04 11:00 -0700
Re: Universal Build System for C Bart <bc@freeuk.com> - 2021-10-06 20:37 +0100
Re: Universal Build System for C Thiago Adams <thiago.adams@gmail.com> - 2021-10-07 06:18 -0700
Re: Universal Build System for C Thiago Adams <thiago.adams@gmail.com> - 2021-10-07 06:25 -0700
Re: Universal Build System for C Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2021-10-07 07:41 -0700
Re: Universal Build System for C Thiago Adams <thiago.adams@gmail.com> - 2021-10-08 14:05 -0700
Re: Universal Build System for C Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2021-10-08 14:22 -0700
Re: Universal Build System for C Thiago Adams <thiago.adams@gmail.com> - 2021-10-08 14:44 -0700
Re: Universal Build System for C Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-10-08 23:25 +0100
Re: Universal Build System for C Thiago Adams <thiago.adams@gmail.com> - 2021-10-08 15:37 -0700
Re: Universal Build System for C Bart <bc@freeuk.com> - 2021-10-08 22:51 +0100
Re: Universal Build System for C Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2021-10-09 01:39 -0700
Re: Universal Build System for C Bart <bc@freeuk.com> - 2021-10-09 11:00 +0100
Re: Universal Build System for C scott@slp53.sl.home (Scott Lurndal) - 2021-10-10 18:09 +0000
8-bit ASCII (was Re: Universal Build System for C) scott@slp53.sl.home (Scott Lurndal) - 2021-10-10 20:55 +0000
Re: Universal Build System for C Bart <bc@freeuk.com> - 2021-10-08 23:05 +0100
Re: Universal Build System for C Thiago Adams <thiago.adams@gmail.com> - 2021-10-08 15:30 -0700
Re: Universal Build System for C Thiago Adams <thiago.adams@gmail.com> - 2021-10-08 18:12 -0700
Re: Universal Build System for C Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2021-10-08 20:51 -0700
Re: Universal Build System for C David Brown <david.brown@hesbynett.no> - 2021-10-09 12:54 +0200
Re: Universal Build System for C Thiago Adams <thiago.adams@gmail.com> - 2021-10-09 06:30 -0700
Re: Universal Build System for C David Brown <david.brown@hesbynett.no> - 2021-10-09 17:29 +0200
Re: Universal Build System for C Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2021-10-08 23:39 +0000
Re: Universal Build System for C Thiago Adams <thiago.adams@gmail.com> - 2021-10-08 17:50 -0700
Re: Universal Build System for C Thiago Adams <thiago.adams@gmail.com> - 2021-11-22 04:26 -0800
Re: Universal Build System for C Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-11-22 20:39 +0000
Re: Universal Build System for C Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2021-11-22 13:18 -0800
Re: Universal Build System for C Bart <bc@freeuk.com> - 2021-11-22 21:49 +0000
Re: Universal Build System for C scott@slp53.sl.home (Scott Lurndal) - 2021-11-23 14:45 +0000
Re: Universal Build System for C Bart <bc@freeuk.com> - 2021-11-23 16:03 +0000
Re: Universal Build System for C Thiago Adams <thiago.adams@gmail.com> - 2022-04-18 14:39 -0700
Re: Universal Build System for C Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2022-04-18 22:17 +0000
Re: Universal Build System for C Thiago Adams <thiago.adams@gmail.com> - 2022-04-18 16:07 -0700
Re: Universal Build System for C scott@slp53.sl.home (Scott Lurndal) - 2021-11-23 14:44 +0000
Re: Universal Build System for C Thiago Adams <thiago.adams@gmail.com> - 2021-11-22 16:19 -0800
Re: Universal Build System for C Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-11-23 01:00 +0000
csiph-web