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

Update makefiles for MSYS2/MinGW-w64 #123

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

feiyunw
Copy link

@feiyunw feiyunw commented Oct 4, 2022

Common changes:

  • CXX, CXXFLAGS, LDFLAGS, RM, LDFLAGS and LDLIBS are common variables used in GNU make built-in rules.
    CXX defaults to 'g++", which will be OK usually.
    see GNU Make manual 10.3 Variables Used by Implicit Rules.
  • Add -I../include, so the ugly #include statements can be rectified in the future.

src/Makefiles/Makefile_mingw:

  • Add common macros for Windows DLLs.
  • THREADING & THREAD_LINK: replace boost w/ winapi
    Boost may not be installed, while winapi is essential on MinGW.
  • Add MINGW32 support.
  • Add -flto -fwhole-program
    FYI:
    w/o -flto: DLL size 387,584 bytes
    w/ -flto (-fuse-linker-plugin): DLL size 409,088 bytes
    w/ -flto -fwhole-program: DLL size 296,960 bytes

test/Makefiles/Makefile_mingw:

  • Add common macros for Windows exe.
  • $(THREAD_LINK): replace boost w/ winapi
  • Use .exe suffix for executales.
    MinGW is for building Windows app.
  • Add -flto
  • Add missing ThreadMgr.cpp to dds_sources.txt

examples/Makefiles/Makefile_mingw:

  • Add common macros for Windows exe.
  • Add missing .cpp suffix in $(ALL_EXAMPLE_FILES).
  • Replace -Wl,--subsystem,windows w/ -mconsole.
  • Optimize rules for executables.
  • Use .PRECIOUS to preserve .o files.
    See GNU Make manual 10.4 Chains of Implicit Rules.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant