Created
June 11, 2014 23:53
-
-
Save alghanmi/eb47fc6151bdb17be249 to your computer and use it in GitHub Desktop.
Sample Makefile for CS 104 homework question
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IDIR =. | |
CC=g++ | |
CFLAGS=-I$(IDIR) -std=c++11 -ggdb | |
ODIR=. | |
LDIR =../lib | |
LIBS=-lm | |
_DEPS = shape.h | |
DEPS = $(patsubst %,$(IDIR)/%,$(_DEPS)) | |
_OBJ = shape.o shape1.o shape2.o | |
OBJ = $(patsubst %,$(ODIR)/%,$(_OBJ)) | |
$(ODIR)/%.o: %.cpp $(DEPS) | |
$(CC) -c -o $@ $< $(CFLAGS) | |
all: shape1 shape2 | |
shape1: shape1.o shape.o | |
$(CC) -o $@ $^ $(CFLAGS) $(LIBS) | |
shape2: shape2.o shape.o | |
$(CC) -o $@ $^ $(CFLAGS) $(LIBS) | |
.PHONY: clean | |
clean: | |
rm -f $(ODIR)/*.o *~ shape1 shape2 $(IDIR)/*~ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment