>So, the issues you are talking about is the fact that nginx won't magically find out which header files you are using, but instead requires you to list them in the ngx_module_deps variable when calling the auto/module in the module config script, correct?
That's not magic. This is what make + gcc/clang/icc can do on *nix. The general pattern is simple: -include $dep $obj $dep: $src $(CC) ... -MMD -MP -MT $obj -MT $dep ... This would make the compiler generate a dependency file together with an object file and make would include/update it when needed. I'm not aware if nginx supports compilers other than gcc/clang, but this trick would work for said compilers. icc mimics gcc on Linux, so generally it will work there too . I'm attaching objs/ngx_modules.d being automatically generated by this approach. That would be a really simple change to auto/make, but it would work much better that _*DEPS. I'm providing a proof-of-working auto/make script from nginx-1.20.2 which uses this technique. You can check how it differs by observing that only several files getting recompiled after touch src/core/ngx_md5.h && make This example should handle addon dependencies too. On Mon, Dec 5, 2022 at 12:10 AM Maxim Dounin <mdou...@mdounin.ru> wrote: > Hello! > > On Sun, Dec 04, 2022 at 11:12:55PM +0300, Dmitry Petrov wrote: > > > >You may want to be more specific about issues you are talking > > about. In general, nginx build system requires little to no > > effort from developers. > > > > I'm speaking about manual vs automatic source-level dependency handling. > > For example, CORE_DEPS is an easy but inaccurate cross-platform hack. The > > same is true for ADDON_DEPS: if you add any header here, all addons will > be > > rebuilt on that header change. > > That's not a big deal, because C compiles fast enough and ccache could be > > used to mitigate "false positives" of hand-written deps. But there's room > > for improvement for sure. > > For example, I had build issues because of forgetting to include headers > > into core/addon deps after splitting addon into a set of header/source > > files. > > So, the issues you are talking about is the fact that nginx won't > magically find out which header files you are using, but instead > requires you to list them in the ngx_module_deps variable when > calling the auto/module in the module config script, correct? > > Thanks for the explanation. > > > >There are no plans to support CMake. > > Targeting any modern C-oriented build system would add many benefits > > including "standardized" routines for library detection, dependency > > handling, etc. > > The "make" build system as used by nginx is a modern, C-oriented > build system. Further, it is standardized, and provides as much > portability as no other build system known. Shell, as used to > generate makefiles, is believed to be simple enough to implement > any needed library detection. > > > Are there any plans on adding "per-addon header deps" so changes to a > > single header don't result in all addons recompiling? > > As of now, there are no such plans. Just rebuilding all the > modules if a header changes is believed to be fast enough > approach. Further, it is usually trivial to configure a build > environment for development which does not contain any additional > modules, reducing potential benefits from such a change. > > -- > Maxim Dounin > http://mdounin.ru/ > _______________________________________________ > nginx-devel mailing list -- nginx-devel@nginx.org > To unsubscribe send an email to nginx-devel-le...@nginx.org > -- Regards, Dmitry
objs/ngx_modules.o objs/ngx_modules.d: objs/ngx_modules.c \ src/core/ngx_config.h objs/ngx_auto_headers.h \ src/os/unix/ngx_linux_config.h objs/ngx_auto_config.h \ src/core/ngx_core.h src/os/unix/ngx_errno.h src/os/unix/ngx_atomic.h \ src/os/unix/ngx_thread.h src/core/ngx_rbtree.h src/os/unix/ngx_time.h \ src/os/unix/ngx_socket.h src/core/ngx_string.h src/os/unix/ngx_files.h \ src/os/unix/ngx_shmem.h src/os/unix/ngx_process.h \ src/os/unix/ngx_setaffinity.h src/os/unix/ngx_setproctitle.h \ src/os/unix/ngx_user.h src/os/unix/ngx_dlopen.h src/core/ngx_parse.h \ src/core/ngx_parse_time.h src/core/ngx_log.h src/os/unix/ngx_alloc.h \ src/core/ngx_palloc.h src/core/ngx_buf.h src/core/ngx_queue.h \ src/core/ngx_array.h src/core/ngx_list.h src/core/ngx_hash.h \ src/core/ngx_file.h src/core/ngx_crc.h src/core/ngx_crc32.h \ src/core/ngx_murmurhash.h src/core/ngx_regex.h src/core/ngx_radix_tree.h \ src/core/ngx_times.h src/core/ngx_rwlock.h src/core/ngx_shmtx.h \ src/core/ngx_slab.h src/core/ngx_inet.h src/core/ngx_cycle.h \ src/core/ngx_resolver.h src/os/unix/ngx_process_cycle.h \ src/core/ngx_conf_file.h src/core/ngx_module.h src/core/nginx.h \ src/core/ngx_open_file_cache.h src/os/unix/ngx_os.h \ src/os/unix/ngx_linux.h src/core/ngx_connection.h src/core/ngx_syslog.h \ src/core/ngx_proxy_protocol.h src/core/ngx_config.h: objs/ngx_auto_headers.h: src/os/unix/ngx_linux_config.h: objs/ngx_auto_config.h: src/core/ngx_core.h: src/os/unix/ngx_errno.h: src/os/unix/ngx_atomic.h: src/os/unix/ngx_thread.h: src/core/ngx_rbtree.h: src/os/unix/ngx_time.h: src/os/unix/ngx_socket.h: src/core/ngx_string.h: src/os/unix/ngx_files.h: src/os/unix/ngx_shmem.h: src/os/unix/ngx_process.h: src/os/unix/ngx_setaffinity.h: src/os/unix/ngx_setproctitle.h: src/os/unix/ngx_user.h: src/os/unix/ngx_dlopen.h: src/core/ngx_parse.h: src/core/ngx_parse_time.h: src/core/ngx_log.h: src/os/unix/ngx_alloc.h: src/core/ngx_palloc.h: src/core/ngx_buf.h: src/core/ngx_queue.h: src/core/ngx_array.h: src/core/ngx_list.h: src/core/ngx_hash.h: src/core/ngx_file.h: src/core/ngx_crc.h: src/core/ngx_crc32.h: src/core/ngx_murmurhash.h: src/core/ngx_regex.h: src/core/ngx_radix_tree.h: src/core/ngx_times.h: src/core/ngx_rwlock.h: src/core/ngx_shmtx.h: src/core/ngx_slab.h: src/core/ngx_inet.h: src/core/ngx_cycle.h: src/core/ngx_resolver.h: src/os/unix/ngx_process_cycle.h: src/core/ngx_conf_file.h: src/core/ngx_module.h: src/core/nginx.h: src/core/ngx_open_file_cache.h: src/os/unix/ngx_os.h: src/os/unix/ngx_linux.h: src/core/ngx_connection.h: src/core/ngx_syslog.h: src/core/ngx_proxy_protocol.h:
auto-make-1.20.2.gz
Description: application/gzip
_______________________________________________ nginx-devel mailing list -- nginx-devel@nginx.org To unsubscribe send an email to nginx-devel-le...@nginx.org