gvanem / Watt-32

Watt-32 TCP/IP library and samples.
https://www.watt-32.net/
18 stars 8 forks source link

Configure options #89

Open jwt27 opened 1 year ago

jwt27 commented 1 year ago

Work in progress, pushing what I have so far:

First commit saves the user's $CFLAGS in the makefile, which I think is generally a good idea. Though there are some targets that produce multiple makefiles, not sure how practical it is for those.

Second commit then allows users to override the config.h macros via $CFLAGS. For example, to make a "release" version of the library for djgpp:

$ export CFLAGS='-O3 -DNDEBUG -DWANT_DEBUG=0 -DWANT_BSD_FATAL=0'
$ ./configur.sh djgpp
$ make -f djgpp.mak

This is just the easiest way to implement it, but maybe not the nicest to use. I'm looking into adding autoconf-style options like --enable-dhcp, and a --help that explains all of them.

jwt27 commented 1 year ago

I'm looking into adding autoconf-style options

command.com may be a bit too simplistic for this :)

jwt27 commented 1 year ago

OK, this should work. CI will complain about missing mkconf.exe for now. But let me know what you think of the idea.

The example above now becomes:

$ export CFLAGS='-O3 -DNDEBUG'
$ ./configur.sh --disable-debug --disable-bsd-fatal djgpp
$ make -f djgpp.mak

Note that for configur.bat, the --enable-x options have to be listed before the target names, and target "all" will ignore all options. The .sh script doesn't have these limitations.