CXX=g++ CXXFLAGS=$(ADD_FLAGS) -Wall -Wextra -O2 -std=c++14 CXXLIBS=-lGL -lGLU -lglut # In `TARGET`, list the names of the `main_[stuff].cpp` you'd like to compile # into a `[stuff].bin`. TARGETS=glut ball bounce OBJS=Implicit.o \ common_structures.o \ Mesh.o \ spheroid.o \ Ball.o \ Ground.o \ FlatGround.o \ PerlinGround.o \ PerlinNoise.o \ util/ObjParser.o \ MarchingCubes.o \ _gen/marching_cubes_data.o \ periodic_updates.o \ GroundFlatMesh.o \ tests/TestImplicitSphere.o \ render/GlutRender.o all: $(TARGETS:=.bin) %.bin: main_%.o $(OBJS) $(CXX) $(CXXFLAGS) $(CXXLIBS) $(OBJS) $< -o $@ _gen/marching_cubes_data.cpp: tools/gen_marching_cubes_conf.py mkdir -p _gen python3 $< > $@ %.o: %.cpp $(CXX) $(CXXFLAGS) -c $< -o $@ ############################################################ .PRECIOUS: %.o .PHONY: clean clean: rm -rf $(OBJS) $(TARGETS:=.bin) _gen clean_render: rm -rf render/*.o $(TARGETS:=.bin)