clang - build with default flags

I want to use clang for cross compiling. I've found out that it seems very easy, I can specify architectures/includes etc. just as I invoke clang directly. However, I don't want to keep passing those flags, I'd rather compile clang so that it would have these by default. That is, when I invoke clang just as clang++ main.cpp I'd like it to become clang++ -i686-w64-mingw32 -target-isystem=/usr/some/path main.cpp etc, how can I do that?

Answers


You can use a response file to do this sort of thing, it's also how you'd avoid command lines that are too long for your OS.

Something like:

clang @target_cmds.inc -c foo.c

will likely work for you.

(In addition to the earlier comments of some build system hackery or an alias, you could also define clang as a wrapper script that you invoke that does the same thing, e.g.:

#!/bin/sh
clang -target i686-w64-mingw32 -target-isystem=/usr/some/path $@

Use a makefile instead. Or create an alias in your bashrc. Everything else are crude hacks which I wouldn't use.


Need Your Help

PyInstaller NameError, not finding packaged module

python-2.7 raspberry-pi pyinstaller raspbian

I have a Pyinstaller set up (automated spec generation and packaging) that's currently working on ubuntu, windows and MacOS.

How to call a specific php function inside a class through ajax?

javascript php ajax

I want to know how I can call the function ajax_check_login available in my User class, this class exists in user.php.