pflarue / ardop

ardopcf - A multi-platform implementation of the Amateur Radio Digital Open Protocol (ARDOP)
Other
30 stars 7 forks source link

Perform txt2c conversion as regular part of build #68

Closed cbs228 closed 5 months ago

cbs228 commented 5 months ago

One open question I have is whether or not txt2c on Windows will accept Linux-style forward-slash paths. If it does not, I will fix it.

GNU Make will automatically delete the intermediate .c files produced during HTML→C conversion. Let me know if this is undesirable and I will fix it.

pflarue commented 5 months ago

This seems to usually work correctly. However, it seems a bit fragile and perhaps more complex than it needs to be. Because of its complexity compared to the two simpler Makefiles that it replaces, I'm having difficulty identifying why the following occurs:

(starting from a clean tree) make (this produces everything as expected)

make

../lib/txt2c/txt2c webgui/webgui.html webgui.html.c webgui_html
gcc -g -MMD   -c -o webgui.html.o webgui.html.c
../lib/txt2c/txt2c webgui/webgui.js webgui.js.c webgui_js
gcc -g -MMD   -c -o webgui.js.o webgui.js.c
gcc -Xlinker -Map=output.map ARDOPCommon.o BusyDetect.o ARDOPC.o ardopSampleArrays.o ARQ.o FFT.o FEC.o HostInterface.o Modulate.o rrs.o txframe.o SoundInput.o TCPHostInterface.o wav.o RXO.o sdft.o rawhid.o ws_server.o Webgui.o webgui.html.o webgui.js.o LinSerial.o ALSASound.o -o ardopcf  -lm -lpthread -lrt -lasound

Since nothing had changed, this should have just printed make: Nothing to be done for 'all'., but instead it rebuilt webgui.html.c, webgui.html.o, webgui.js.c, and webgui.html.o. Also, it didn't delete webgui.html.c and webgui.js.c when it was done, as occurred during the first make. Furthermore, once one or both of these c files exist, neither make nor make clean ever gets rid of them.

I ended up with these extra c files by accident. After manually deleting them, I identified this as a repeatable sequence that recreates them. However, I'm not sure whether this is how I got there the first time or whether it was by some other route. I have not tested whether this sequence of commands produces the same problem on Windows.

cbs228 commented 5 months ago

I can repro this just by double-making, i.e.

make
make

For some reason, the second time around Make is losing the notion that the generated .c file is intermediate. The second time around, make -d reports:

Found an implicit rule for 'webgui.html.c'

which should not be the case; the rule is explicit.

I rewrote the pattern rule to match more narrowly. That seems to have fixed it for me.

EDIT: see the updated PR.