Advertisement
obernardovieira

Compile multifiles without clean .o

Mar 6th, 2014
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Make 0.23 KB | None | 0 0
  1. CC=g++
  2. CFLAGS=-c -Wall
  3. LDFLAGS=
  4. SOURCES=*.cpp
  5. OBJECTS=$(SOURCES:.cpp=.o)
  6. EXECUTABLE=hello
  7.  
  8. all: $(SOURCES) $(EXECUTABLE)
  9.    
  10. $(EXECUTABLE): $(OBJECTS)
  11.     $(CC) $(LDFLAGS) $(OBJECTS) -o $@
  12.  
  13. .cpp.o:
  14.     $(CC) $(CFLAGS) $< -o $@
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement