Better makefile.
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -29,5 +29,6 @@
|
|||||||
*.app
|
*.app
|
||||||
ray
|
ray
|
||||||
|
|
||||||
# Emacs droppings
|
# Others
|
||||||
|
*.d
|
||||||
*~
|
*~
|
||||||
|
33
Makefile
33
Makefile
@@ -1,30 +1,27 @@
|
|||||||
TARGET = ray
|
|
||||||
HEADERS = ray.hpp figure.hpp sphere.hpp plane.hpp disk.hpp material.hpp light.hpp directional_light.hpp point_light.hpp tracer.hpp
|
|
||||||
OBJECTS = main.o sphere.o plane.o disk.o directional_light.o point_light.o tracer.o
|
|
||||||
CXX = g++
|
CXX = g++
|
||||||
CXXFLAGS = -ansi -pedantic -Wall -g -DGLM_FORCE_RADIANS -fopenmp
|
TARGET = ray
|
||||||
|
OBJECTS = main.o disk.o plane.o sphere.o directional_light.o point_light.o tracer.o
|
||||||
|
DEPENDS = $(OBJECTS:.o=.d)
|
||||||
|
CXXFLAGS = -ansi -pedantic -Wall -DGLM_FORCE_RADIANS -fopenmp
|
||||||
LDLIBS =
|
LDLIBS =
|
||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
|
all: CXXFLAGS += -O2 -DNDEBUG
|
||||||
all: $(TARGET)
|
all: $(TARGET)
|
||||||
|
|
||||||
$(TARGET): $(OBJECTS) $(HEADERS)
|
.PHONY: debug
|
||||||
$(CXX) $(CXXFLAGS) -o $@ $(OBJECTS) $(LDLIBS)
|
debug: CXXFLAGS += -g
|
||||||
|
debug: $(TARGET)
|
||||||
|
|
||||||
main.o: main.cpp $(HEADERS)
|
$(TARGET): $(OBJECTS)
|
||||||
|
$(CXX) -o $(TARGET) $(OBJECTS) $(CXXFLAGS) $(LDLIBS)
|
||||||
|
|
||||||
sphere.o: sphere.cpp $(HEADERS)
|
-include $(DEPENDS)
|
||||||
|
|
||||||
plane.o: plane.cpp $(HEADERS)
|
%.o: %.cpp
|
||||||
|
$(CXX) -c $(CXXFLAGS) $*.cpp -o $*.o
|
||||||
disk.o: disk.cpp $(HEADERS)
|
$(CXX) -MM $(CXXFLAGS) $*.cpp > $*.d
|
||||||
|
|
||||||
tracer.o: tracer.cpp $(HEADERS)
|
|
||||||
|
|
||||||
directional_light.o: directional_light.cpp $(HEADERS)
|
|
||||||
|
|
||||||
point_light.o: point_light.cpp $(HEADERS)
|
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
$(RM) $(TARGET) $(OBJECTS)
|
$(RM) $(TARGET) $(OBJECTS) $(DEPENDS)
|
||||||
|
Reference in New Issue
Block a user