Code cleanup and commentary
This commit is contained in:
		
							
								
								
									
										16
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								Makefile
									
									
									
									
									
								
							@@ -1,3 +1,5 @@
 | 
			
		||||
# ---------- Variables listed below --------- #
 | 
			
		||||
 | 
			
		||||
# Executable
 | 
			
		||||
TARGET := main.out
 | 
			
		||||
 | 
			
		||||
@@ -17,7 +19,12 @@ CFLAGS = -I$(IPATH) -pthread -lrt
 | 
			
		||||
SOURCES = $(wildcard $(SPATH)/*.cpp)
 | 
			
		||||
OBJECTS = $(addprefix $(OPATH)/,$(notdir $(SOURCES:.cpp=.o)))
 | 
			
		||||
 | 
			
		||||
.PHONY: all clean dump
 | 
			
		||||
 | 
			
		||||
# ----------- Targets listed below ---------- #
 | 
			
		||||
# Some targets aren't real
 | 
			
		||||
.PHONY: all clean run dump
 | 
			
		||||
# Don't autodelete object files:
 | 
			
		||||
.PRECIOUS: $(OPATH)/%.o
 | 
			
		||||
 | 
			
		||||
all: $(DPATH) $(OPATH) $(TARGET)
 | 
			
		||||
 | 
			
		||||
@@ -31,6 +38,9 @@ clean:
 | 
			
		||||
	-rm $(TARGET)
 | 
			
		||||
	-rm -r dep obj
 | 
			
		||||
 | 
			
		||||
run:
 | 
			
		||||
	-$(addprefix ./,$(addsuffix ;,$(TARGET)))
 | 
			
		||||
 | 
			
		||||
$(DPATH) $(OPATH):
 | 
			
		||||
	mkdir -p $@
 | 
			
		||||
 | 
			
		||||
@@ -41,8 +51,6 @@ $(DPATH) $(OPATH):
 | 
			
		||||
$(OPATH)/%.o: $(SPATH)/%.cpp
 | 
			
		||||
	$(CC) $(CFLAGS) -MMD -MF $(DPATH)/$(@F:.o=.d) -o $@ -c $<
 | 
			
		||||
 | 
			
		||||
# Don't autodelete object files:
 | 
			
		||||
.SECONDARY: $(OPATH)/%.o
 | 
			
		||||
 | 
			
		||||
# --------- Inclusions listed below --------- #
 | 
			
		||||
# use dependencies when rebuilding
 | 
			
		||||
-include $(wildcard $(DPATH)/*.d)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user