Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Makefile.m32: deduplicate build rules #9642

Closed
wants to merge 30 commits into from
Closed

Conversation

vszakats
Copy link
Member

@vszakats vszakats commented Oct 4, 2022

After this patch, we reduce the three copies of most Makefile.m32 logic
to one. This now resides in lib/Makefile.m32. It makes future updates
easier, the code shorter, with a small amount of added complexity.

Makefile.m32 reduction:

bytes LOC total blank comment code
7.85.0 34772 1337 79 192 1066
before this patch 17601 625 62 106 457
after this patch 11680 392 52 104 236

Details:

  • Change rules to create objects for the v* subdirs in the lib dir.
    This allows to use a shared compile rule and assumes that filenames
    are not (and will not be) colliding across these directories.
    Makefile.m32 now also stores a list of these subdirs. They are
    changing rarely though.

  • Sync as much as possible between the three Makefile.m32 scripts'
    rules and their source/target sections.

  • After this patch CPPFLAGS are all applied to the src sources once
    again. This matches the behaviour of cmake/autotools. Only zlib ones
    are actually required there.

  • Use .rc names from Makefile.inc instead of keeping a duplicate.

  • Change examples to link libcurl.dll by default. This makes building
    trivial, even as a cross-build:
    CC=x86_64-w64-mingw32-gcc make -f Makefile.m32
    To run them, you need to move/copy or add-to-path libcurl.dll.
    You can select static mode via CFG=-static.

  • List more of the Makefile.m32 config variables.

  • Drop .rc support from examples. It made it more fragile without much
    benefit.

  • Include a necessary system lib for the externalsocket.c example.

  • Exclude unnecessary systems libs when building in -dyn mode.

Closes #9642

@vszakats vszakats added build Windows Windows-specific tidy-up labels Oct 4, 2022
@vszakats vszakats changed the title Makefile.m32: Dedupe common logic [ci skip] Makefile.m32: dedupe common logic [ci skip] Oct 4, 2022
vszakats added 7 commits Oct 4, 2022
This makes it more likely to work without having to specify
a correct `CURL_DLL_SUFFIX`. The implib should be updated in
sync with the .dll, so this won't cause issues for most cases.
This makes the build work without having to point to every single
dependent static libs with *_PATH envvars. The downside is that
the .dll must be copied to examples directory, but at that point
at least we have the .exe built.
@vszakats vszakats changed the title Makefile.m32: dedupe common logic [ci skip] Makefile.m32: deduplicate build rules [ci skip] Oct 4, 2022
@vszakats vszakats changed the title Makefile.m32: deduplicate build rules [ci skip] Makefile.m32: deduplicate build rules Oct 4, 2022
@vszakats vszakats closed this in 7844008 Oct 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant