RE: mk-opt-list.mak
Gisle Vanem wrote: > Not sure what "buildconf" + "configure" would do. > Here is another try with a man-file check added. Sorry for being long. I've tried this version too: this works. But there are compilation warnings. Please find the test log in attachment. It includes make attempts without the buildconf + configure to show you why it's needed. Cheers, PatrickScript started on Sat 27 Feb 2016 05:44:07 PM GMT-1 [patrick@patrick curl]$ cp -a curl curl.mkoptlist [patrick@patrick curl]$ mv ~/mk-opt-list.mak curl.mkoptlist/lib/ [patrick@patrick curl]$ cd curl.mkoptlist/lib [patrick@patrick lib]$ make -f mk-opt-list.mak 224 options generated for curl_options.c. gcc -Wall -I../include -o curl_options curl_options.c In file included from curl_options.c:6:0: ../include/curl/curl.h:34:61:fatal error: curlbuild.h: No such file or directory compilation terminated. mk-opt-list.mak:104: recipe for target 'curl_options' failed make: *** [curl_options] Error 1 [patrick@patrick lib]$ cd .. [patrick@patrick curl.mkoptlist]$ ./buildconf buildconf: autoconf version 2.69 (ok) buildconf: autom4te version 2.69 (ok) buildconf: autoheader version 2.69 (ok) buildconf: automake version 1.15 (ok) buildconf: aclocal version 1.15 (ok) buildconf: libtoolize version 2.4.6 (ok) buildconf: GNU m4 version 1.4.17 (ok) buildconf: running libtoolize libtoolize: putting auxiliary files in '.'. libtoolize: copying file './ltmain.sh' libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'. libtoolize: copying file 'm4/libtool.m4' libtoolize: copying file 'm4/ltoptions.m4' libtoolize: copying file 'm4/ltsugar.m4' libtoolize: copying file 'm4/ltversion.m4' libtoolize: copying file 'm4/lt~obsolete.m4' libtoolize: Remember to add 'LT_INIT' to configure.ac. buildconf: converting all mv to mv -f in local m4/libtool.m4 buildconf: running aclocal buildconf: converting all mv to mv -f in local aclocal.m4 buildconf: running autoheader buildconf: running autoconf buildconf: running automake configure.ac:130: installing './compile' configure.ac:184: installing './config.guess' configure.ac:184: installing './config.sub' configure.ac:130: installing './install-sh' configure.ac:131: installing './missing' docs/examples/Makefile.am: installing './depcomp' parallel-tests: installing './test-driver' buildconf: OK [patrick@patrick curl.mkoptlist]$ cd lib [patrick@patrick lib]$ make -f mk-opt-list.mak gcc -Wall -I../include -o curl_options curl_options.c In file included from curl_options.c:6:0: ../include/curl/curl.h:34:61:fatal error: curlbuild.h: No such file or directory compilation terminated. mk-opt-list.mak:104: recipe for target 'curl_options' failed make: *** [curl_options] Error 1 [patrick@patrick lib]$ cd .. [patrick@patrick curl.mkoptlist]$ configure checking whether to enable maintainer-specific portions of Makefiles... no checking whether make supports nested variables... yes checking whether to enable debug build options... no checking whether to enable compiler optimizer... (assumed) yes checking whether to enable strict compiler warnings... no checking whether to enable compiler warnings as errors... no checking whether to enable curl debug memory tracking... no checking whether to enable hiding of library internal symbols... yes checking whether to enable c-ares for DNS lookups... no checking whether to disable dependency on -lrt... (assumed no) checking for path separator... : checking for sed... /usr/bin/sed checking for grep... /usr/bin/grep checking for egrep... /usr/bin/grep -E checking for ar... /usr/bin/ar checking for a BSD-compatible install... /usr/bin/install -c checking for gcc... gcc checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ISO C89... none needed checking whether gcc understands -c and -o together... yes checking how to run the C preprocessor... gcc -E checking whether build environment is sane... yes checking for a thread-safe mkdir -p... /usr/bin/mkdir -p checking for gawk... gawk checking whether make sets $(MAKE)... yes checking for style of include used by make... GNU checking dependency style of gcc... gcc3 checking curl version... 7.47.2-DEV checking build system type... x86_64-unknown-linux-gnu checking host system type... x86_64-unknown-linux-gnu checking for sys/types.h... yes checking for stdint.h... yes checking for inttypes.h... yes checking for grep that handles long lines and -e... (cached) /usr/bin/grep checking for egrep... /usr/bin/grep -E checking for ANSI C header files... yes checking for sys/types.h... (cached) yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h...
RE: mk-opt-list.mak
Gisle Vanem wrote: > I've been toying with the attached GNU-makefile which creates a program > (curl_options). > I'd be happy if someone can test it on some other OS than Windows. I tried it on Fedora 23 64-bit: it works providing you make/run it from a direct subdirectory of curl sources. I had to "buildconf" + "configure" to make it run. Patrick --- List admin: https://cool.haxx.se/list/listinfo/curl-library Etiquette: https://curl.haxx.se/mail/etiquette.html
Re: mk-opt-list.mak
Patrick Monnerat wrote: > I tried it on Fedora 23 64-bit: it works providing you make/run it from a > direct > subdirectory of curl sources. I had to "buildconf" + "configure" to make it > run. I simply assumed that. Not sure what "buildconf" + "configure" would do. Here is another try with a man-file check added. -- --gv # # A Gnu-makefile to generate a file (curl_options.c) with all # current 'CURLOPT_x' values. # # NB! must be invoked from libcurl's './lib' directory. # # By G. Vanem2014. # empty := space := $(empty) $(empty) $(empty) OPTIONS = grep '^ CINIT(' ../include/curl/curl.h | cut -f1 -d, | sed 's/CINIT(/CURLOPT_/' OPTIONS := $(shell $(OPTIONS)) CC = gcc CFLAGS = -Wall -I../include define CURLOPT_TOP /* * This file has been generated by $(realpath $(MAKEFILE_LIST)) at * $(shell date +%d-%B-%Y). * DO NOT EDIT! */ #include struct key_val { unsignedval; const char *name; const char *man3_page; }; #if defined(_WIN32) #include #define FILE_EXIST(fname) (access(fname,0) == 0) #else #include #define FILE_EXIST(fname) (chmod(fname,0) != -1) #endif #define ADD_OPT(opt) { opt, #opt, "../docs/libcurl/opts/" #opt ".3" } static const struct key_val options[] = { endef define CURLOPT_BOTTOM }; const char *decode_opt (unsigned opt) { static char ret[100]; const char *type = "long"; /* CURLOPTTYPE_LONG == 0 */ if (opt >= CURLOPTTYPE_OFF_T) { opt -= CURLOPTTYPE_OFF_T; type = "off_t"; } else if (opt >= CURLOPTTYPE_FUNCTIONPOINT) { opt -= CURLOPTTYPE_FUNCTIONPOINT; type = "function"; } else if (opt >= CURLOPTTYPE_OBJECTPOINT) { opt -= CURLOPTTYPE_OBJECTPOINT; type = "object/string"; } snprintf (ret, sizeof(ret), "%3u: %s", opt, type); return (ret); } int man3_page_exist (const struct key_val *o) { if (!o->man3_page) return (0); if (!strncmp(o->name,"CURLOPT_OBSOLETE",16)) /* Ignore these */ return (1); return FILE_EXIST (o->man3_page); } int main (void) { const struct key_val *o = options; int i; puts ("Idx CURLOPT_x value: arg type raw value\n" "=="); for (i = 0; i < sizeof(options) / sizeof(options[0]); i++, o++) printf ("%3d: %-35.35s -> %-20s %5u %s\n", i, o->name, decode_opt(o->val), o->val, man3_page_exist(o) ? "" : "missing .3 file!"); return (0); } endef all: check_libdir curl_options curl_options.c: $(MAKEFILE_LIST) $(file > $@,$(CURLOPT_TOP)) $(foreach o, $(sort $(OPTIONS)), \ $(file >> $@, $(space) ADD_OPT ($(o)), ) ) $(file >> $@,$(CURLOPT_BOTTOM)) @echo '$(words $(OPTIONS)) options generated for $@.' curl_options: curl_options.c $(CC) $(CFLAGS) -o $@ $< check_libdir: ifeq ($(wildcard curl_setup.h),) $(error Must be invoked from libcurl's './lib' directory.) endif clean: rm -f curl_options.* --- List admin: https://cool.haxx.se/list/listinfo/curl-library Etiquette: https://curl.haxx.se/mail/etiquette.html