Skip to content

Instantly share code, notes, and snippets.

@icedraco
Created November 27, 2014 11:37
Show Gist options
  • Select an option

  • Save icedraco/6e81e096f60d4b06e3e0 to your computer and use it in GitHub Desktop.

Select an option

Save icedraco/6e81e096f60d4b06e3e0 to your computer and use it in GitHub Desktop.
Makefile nesting example
EXEC=test
all:
cd src; make
mv src/$(EXEC) ./
clean:
rm -f src/*.o $(EXEC)
CC=g++
EXEC=test
FLAGS=-g
SRC=DataType.cpp Exception.cpp Interpreter.cpp IO.cpp MyFloat.cpp MyInteger.cpp MyList.cpp MyString.cpp
OBJ=$(addsuffix .o, $(basename $(SRC)))
all: $(OBJ)
$(CC) $(FLAGS) -o $(EXEC) $(OBJ)
.cpp.o:
$(CC) $(FLAGS) -c $<
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment