Skip to content

Instantly share code, notes, and snippets.

@mtourne
Created April 10, 2015 00:31
Show Gist options
  • Save mtourne/3025e0b5475acfedd3ef to your computer and use it in GitHub Desktop.
Save mtourne/3025e0b5475acfedd3ef to your computer and use it in GitHub Desktop.
Compiling two c++ standards at once ?
CPP=g++
SRC=main.03.cc toto.11.cc
BIN=foo
OBJ=$(SRC:.cc=.o)
LDFLAGS=
CXXFLAGS=-O0 -g
all:$(BIN)
$(BIN):$(OBJ)
$(CPP) -o $(BIN) $(LDFLAGS) $(OBJ)
.SUFFIXES:
.SUFFIXES: .11.o .03.o .11.cc .03.cc
.03.cc.03.o:
$(CPP) -o $@ $(CXXFLAGS) -c $<
.11.cc.11.o:
$(CPP) -o $@ $(CFXXLAGS) -std=c++11 -c $<
depends:
head -n `grep -n "^#depends#" Makefile | cut -d: -f 1` Makefile >\
Makefile.tmp
$(CPP) -MM $(SRC) >> Makefile.tmp
mv Makefile.tmp Makefile
clean:distclean
distclean:
rm -rf *.o *~
# generated do not edit under this line #
#depends#
main.03.o: main.03.cc toto.h
toto.11.o: toto.11.cc toto.h
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment