[MacPorts] #69782: legacy-support: Minor issues with ARCHFLAGS in the Makefile

MacPorts noreply at macports.org
Sat Apr 20 00:22:33 UTC 2024


#69782: legacy-support: Minor issues with ARCHFLAGS in the Makefile
-------------------------+----------------------------
 Reporter:  TurtleWilly  |      Owner:  (none)
     Type:  enhancement  |     Status:  new
 Priority:  Low          |  Milestone:
Component:  ports        |    Version:
 Keywords:               |       Port:  legacy-support
-------------------------+----------------------------
 Not a real problem, and easy to workaround, but I wanted to report it
 anyway.

 In the Makefile it does the following:


 {{{
 FORCE_ARCH      ?=
 ARCHFLAGS       ?=
 LIPO            ?= lipo
 CC              ?= cc $(ARCHFLAGS)
 CFLAGS          ?= -Os -Wall -Wno-deprecated-declarations
 DLIBCFLAGS      ?= -fPIC
 SLIBCFLAGS      ?=
 CXX             ?= c++ $(ARCHFLAGS)
 CXXFLAGS        ?= -Os -Wall
 }}}


 So building with "make FORCE_ARCH=i368 ARCHFLAGS='-arch i368'" I expected
 to get a proper i386 build of the library, but I ended up with a x86_64
 one anyway. It seems that "$(ARCHFLAGS)" is not expanded in the "CC ?= …"
 and "CXX ?= …" lines and simply ends up empty, hence the it progresses
 with a native arch build. Switching both lines from "?=" to just "=" makes
 things work (ultimately I just passed CC and CXX including the arch
 parameter as arguments to make instead using the ARCHFLAGS variable).


 {{{
 $ make --version
 GNU Make 3.81
 Copyright (C) 2006  Free Software Foundation, Inc.
 This is free software; see the source for copying conditions.
 There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
 PARTICULAR PURPOSE.

 This program built for i386-apple-darwin11.3.0
 }}}

 (XCode 7.2/ OS X 10.10.5 Yosemite)


 Unrelated to the actual issue above I think the BUILDING.txt could need
 some clarification how things work. I sounds a bit confusing. E.g. I
 assumed it would work with just FORCE_ARCH. It also could mention the
 supported arches, so one doesn't have to dig it out of the Makefile source
 code.

-- 
Ticket URL: <https://trac.macports.org/ticket/69782>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list