Swift Packages, Linux, custom C-code and /usr/local/lib

I spent a few more hours hitting my head against the issue. I still cannot find a way to link using a custom library search path. For now, my Makefile copies my .a file to /usr/local/lib. I consider this a defeat, even though I can now build pure-C libraries and call them from Swift.

% cat Makefile

	cc -c $(PKGNAME).c -o $(PKGNAME).o
	ar rvs $(PKGNAME).a $(PKGNAME).o
	sudo cp $(PKGNAME).a /usr/local/lib/lib$(PKGNAME).a
	git init ; git add . ; git commit -m "Commit" ; git tag 1.0.0

	rm -rf .git
	sudo rm /usr/local/lib/lib$(PKGNAME).a
	rm *~ *.[ao]

I’ve tried sneaking flags into the “link” entry for module maps (including -L and -v) and got nowhere. I’ve tried walking through the documentation, trying to find any kind of tweaks around this, but still nothing.

If my intent were to create a re-usable package that’s applicable to multiple projects, /usr/local/lib would be the way to go. Right now, I just want a way to build stuff in C to work around early Swift language limitations on Linux. This means I’m cluttering up a meaningful folder with non-meaningful libraries of temporary code.