Quantcast
Channel: OS detecting makefile - Stack Overflow
Viewing all articles
Browse latest Browse all 15

Answer by Huckle for OS detecting makefile

$
0
0

I ran into this problem today and I needed it on Solaris so here is a POSIX standard way to do (something very close to) this.

#Detect OSUNAME = `uname`# Build based on OS nameDetectOS:    -@make $(UNAME)# OS is Linux, use GCCLinux: program.c    @SHELL_VARIABLE="-D_LINUX_STUFF_HERE_"    rm -f program    gcc $(SHELL_VARIABLE) -o program program.c# OS is Solaris, use c99SunOS: program.c    @SHELL_VARIABLE="-D_SOLARIS_STUFF_HERE_"    rm -f program    c99 $(SHELL_VARIABLE) -o program program.c

Viewing all articles
Browse latest Browse all 15

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>