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

OS detecting makefile

$
0
0

I routinely work on several different computers and several different operating systems, which are Mac OS X, Linux, or Solaris. For the project I'm working on, I pull my code from a remote git repository.

I like to be able to work on my projects regardless of which terminal I'm at. So far, I've found ways to get around the OS changes by changing the makefile every time I switch computers. However, this is tedious and causes a bunch of headaches.

How can I modify my makefile so that it detects which OS I'm using and modifies syntax accordingly?

Here is the makefile:

cc = gcc -gCC = g++ -gyacc=$(YACC)lex=$(FLEX)all: assemblerassembler: y.tab.o lex.yy.o        $(CC) -o assembler y.tab.o lex.yy.o -ll -l yassembler.o: assembler.c        $(cc) -o assembler.o assembler.cy.tab.o: assem.y        $(yacc) -d assem.y        $(CC) -c y.tab.clex.yy.o: assem.l        $(lex) assem.l        $(cc) -c lex.yy.cclean:        rm -f lex.yy.c y.tab.c y.tab.h assembler *.o *.tmp *.debug *.acts

Viewing all articles
Browse latest Browse all 15

Trending Articles