Makefile a inkrementace cisla buildu

Petr Simek psimek na jcu.cz
Pátek Leden 15 09:05:23 CET 2016


On Fri, 15 Jan 2016, Pavel Kutina wrote:

> To je zjevne presno, to, co bych potreboval, jen pro Windows. V bashi bych si 
> to naskriptoval taky, na Win se ptam, jestli to uz nekdo nema vytvorene ci 
> nepouziva ono "neco", co to dela. Ne ze bych si to nemohl treba v mem

Tady  -

   http://www.avrfreaks.net/forum/automatically-increment-build-version-number-firmware

je priklad na inkrementaci v Makefile , presmerovani stdin/stdout <> na
soubor counter snad uz win zvladnou :

   #
   # Increment counter and write buildnum.c
   # Do not name this rule buildnum.c although it creates buildnum.c
   # TODO: Add file locking for concurrent builds
   #
   buildnum: counter
         read LASTNUM < counter;         \
         NEWNUM=$$(($$LASTNUM + 1));             \
         echo "const int buildnum = $$NEWNUM;" > buildnum.c; \
         echo "$$NEWNUM" > counter

   buildnum.c: buildnum
   .PHONY: buildnum
   clean::
         -rm -f buildnum.c


> Pavel Kutina

*------------------------------------------------------------------------*
|                          Petr Simek   APS JU                           |
|                             psimek na jcu.cz                              |
*------------------------------------------------------------------------*


Další informace o konferenci Hw-list