5 ms·
if you're building C please try to use the built-in rules. I often come across reimplementations that miss or disorder one of the flag sets and it becomes a pai
by raggi 4y ago
if you're building C please try to use the built-in rules. I often come across reimplementations that miss or disorder one of the flag sets and it becomes a pain when porting or integrating.
General reminder: you don't even necessarily need a make file to build C:
~ % echo 'void main(){printf("hello");}' > example.c
~ % make example
cc example.c -o example
...
2 warnings generated.
~ % ./example
hello%
- bin_bash 4y agoThis is really cool! I've always worked in interpreted code so this isn't that useful to me but I'm surprised that it exists. I tried it myself though and it complains about not including stdio.h and wanting `int main` instead of `void main`. Though of course I still get your point.
- raggi 4y agoYes, I left out the warnings for brevity. It's a bit of a pain to do all the includes in a one-liner :) What this does allow you to do though, is also do things like: make CFLAGS=-DFOO LDFLAGS=-lfoo example