Skip to content

Commit 68936f2

Browse files
committed
Updated the Makefile of project
1 parent 42326bc commit 68936f2

File tree

10 files changed

+150
-1
lines changed

10 files changed

+150
-1
lines changed

Makefile

Lines changed: 81 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Builds all available modules and examples
33

44
# Default target
5-
.PHONY: all clean test help module1 module2 module3 module4 module5 module6 module7 module8 module9
5+
.PHONY: all clean test debug profile help module1 module2 module3 module4 module5 module6 module7 module8 module9
66

77
# Build all available modules
88
all: module1 module2 module3 module4 module5 module6 module7 module8 module9
@@ -83,6 +83,84 @@ test-module9:
8383
@echo "Testing Module 9..."
8484
@$(MAKE) -C modules/module9/examples test
8585

86+
# Debug builds for all modules
87+
debug: debug-module1 debug-module2 debug-module3 debug-module4 debug-module5 debug-module6 debug-module7 debug-module8 debug-module9
88+
89+
debug-module1:
90+
@echo "Debug build Module 1..."
91+
@$(MAKE) -C modules/module1/examples debug
92+
93+
debug-module2:
94+
@echo "Debug build Module 2..."
95+
@$(MAKE) -C modules/module2/examples debug
96+
97+
debug-module3:
98+
@echo "Debug build Module 3..."
99+
@$(MAKE) -C modules/module3/examples debug
100+
101+
debug-module4:
102+
@echo "Debug build Module 4..."
103+
@$(MAKE) -C modules/module4/examples debug
104+
105+
debug-module5:
106+
@echo "Debug build Module 5..."
107+
@$(MAKE) -C modules/module5/examples debug
108+
109+
debug-module6:
110+
@echo "Debug build Module 6..."
111+
@$(MAKE) -C modules/module6/examples debug
112+
113+
debug-module7:
114+
@echo "Debug build Module 7..."
115+
@$(MAKE) -C modules/module7/examples debug
116+
117+
debug-module8:
118+
@echo "Debug build Module 8..."
119+
@$(MAKE) -C modules/module8/examples debug
120+
121+
debug-module9:
122+
@echo "Debug build Module 9..."
123+
@$(MAKE) -C modules/module9/examples debug
124+
125+
# Profile builds for all modules
126+
profile: profile-module1 profile-module2 profile-module3 profile-module4 profile-module5 profile-module6 profile-module7 profile-module8 profile-module9
127+
128+
profile-module1:
129+
@echo "Profile build Module 1..."
130+
@$(MAKE) -C modules/module1/examples profile
131+
132+
profile-module2:
133+
@echo "Profile build Module 2..."
134+
@$(MAKE) -C modules/module2/examples profile
135+
136+
profile-module3:
137+
@echo "Profile build Module 3..."
138+
@$(MAKE) -C modules/module3/examples profile
139+
140+
profile-module4:
141+
@echo "Profile build Module 4..."
142+
@$(MAKE) -C modules/module4/examples profile
143+
144+
profile-module5:
145+
@echo "Profile build Module 5..."
146+
@$(MAKE) -C modules/module5/examples profile
147+
148+
profile-module6:
149+
@echo "Profile build Module 6..."
150+
@$(MAKE) -C modules/module6/examples profile
151+
152+
profile-module7:
153+
@echo "Profile build Module 7..."
154+
@$(MAKE) -C modules/module7/examples profile
155+
156+
profile-module8:
157+
@echo "Profile build Module 8..."
158+
@$(MAKE) -C modules/module8/examples profile
159+
160+
profile-module9:
161+
@echo "Profile build Module 9..."
162+
@$(MAKE) -C modules/module9/examples profile
163+
86164
# Clean all builds
87165
clean:
88166
@echo "Cleaning all modules..."
@@ -193,6 +271,8 @@ help:
193271
@echo " all - Build all available modules"
194272
@echo " clean - Clean all build artifacts"
195273
@echo " test - Run all available tests"
274+
@echo " debug - Build all modules with debug flags"
275+
@echo " profile - Build all modules with profiling flags"
196276
@echo " help - Show this help message"
197277
@echo ""
198278
@echo "Module targets:"

modules/module1/examples/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,12 +185,30 @@ debug: CUDA_FLAGS = $(CUDA_DEBUG_FLAGS)
185185
debug: HIP_FLAGS = $(HIP_DEBUG_FLAGS)
186186
debug: all
187187

188+
# Profile builds
189+
.PHONY: profile
190+
profile: CUDA_FLAGS = $(CUDA_FLAGS) -lineinfo
191+
profile: HIP_FLAGS = $(HIP_FLAGS) -g
192+
profile: all
193+
188194
# Clean
189195
.PHONY: clean
190196
clean:
191197
@echo "Cleaning build artifacts..."
192198
rm -rf $(BUILD_DIR) $(PROFILE_DIR)
193199

200+
# Test target - run built examples
201+
.PHONY: test
202+
test: all
203+
@echo "Running Module 1 Tests..."
204+
@for target in $(ALL_TARGETS); do \
205+
if [ -f $$target ]; then \
206+
echo "Testing $$target..."; \
207+
$$target || echo "Test completed with exit code $$?"; \
208+
echo ""; \
209+
fi; \
210+
done
211+
194212
# Help
195213
.PHONY: help
196214
help:
@@ -200,5 +218,7 @@ help:
200218
@echo " cuda - Build CUDA examples (requires NVIDIA GPU)"
201219
@echo " hip - Build HIP examples (requires AMD GPU)"
202220
@echo " debug - Build with debug flags"
221+
@echo " profile - Build with profiling flags"
222+
@echo " test - Run all built examples"
203223
@echo " clean - Remove build artifacts"
204224
@echo " help - Show this help message"

modules/module2/examples/Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,12 @@ debug: CUDA_FLAGS = $(CUDA_DEBUG_FLAGS)
138138
debug: HIP_FLAGS = $(HIP_DEBUG_FLAGS)
139139
debug: all
140140

141+
# Profile builds
142+
.PHONY: profile
143+
profile: CUDA_FLAGS = $(CUDA_FLAGS) -lineinfo
144+
profile: HIP_FLAGS = $(HIP_FLAGS) -g
145+
profile: all
146+
141147
# Clean
142148
.PHONY: clean
143149
clean:

modules/module3/examples/Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,12 @@ debug: CUDA_FLAGS = $(CUDA_DEBUG_FLAGS)
138138
debug: HIP_FLAGS = $(HIP_DEBUG_FLAGS)
139139
debug: all
140140

141+
# Profile builds
142+
.PHONY: profile
143+
profile: CUDA_FLAGS = $(CUDA_FLAGS) -lineinfo
144+
profile: HIP_FLAGS = $(HIP_FLAGS) -g
145+
profile: all
146+
141147
# Clean\n.PHONY: clean\nclean:\n\t@echo \"Cleaning build artifacts...\"\n\trm -rf $(BUILD_DIR) $(PROFILE_DIR)
142148

143149
# Help

modules/module4/examples/Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,12 @@ debug: CUDA_FLAGS = $(CUDA_DEBUG_FLAGS)
152152
debug: HIP_FLAGS = $(HIP_DEBUG_FLAGS)
153153
debug: all
154154

155+
# Profile builds
156+
.PHONY: profile
157+
profile: CUDA_FLAGS = $(CUDA_FLAGS) -lineinfo
158+
profile: HIP_FLAGS = $(HIP_FLAGS) -g
159+
profile: all
160+
155161
# Clean
156162
.PHONY: clean
157163
clean:

modules/module5/examples/Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,12 @@ debug: CUDA_FLAGS = $(CUDA_DEBUG_FLAGS)
123123
debug: HIP_FLAGS = $(HIP_DEBUG_FLAGS)
124124
debug: all
125125

126+
# Profile builds
127+
.PHONY: profile
128+
profile: CUDA_FLAGS = $(CUDA_FLAGS) -lineinfo
129+
profile: HIP_FLAGS = $(HIP_FLAGS) -g
130+
profile: all
131+
126132
# Clean build artifacts
127133
.PHONY: clean
128134
clean:

modules/module6/examples/Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,12 @@ debug: CUDA_FLAGS = $(CUDA_DEBUG_FLAGS)
121121
debug: HIP_FLAGS = $(HIP_DEBUG_FLAGS)
122122
debug: all
123123

124+
# Profile builds
125+
.PHONY: profile
126+
profile: CUDA_FLAGS = $(CUDA_FLAGS) -lineinfo
127+
profile: HIP_FLAGS = $(HIP_FLAGS) -g
128+
profile: all
129+
124130
# Algorithm-specific targets
125131
.PHONY: convolution
126132
convolution: setup

modules/module7/examples/Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,12 @@ debug: CUDA_FLAGS = $(CUDA_DEBUG_FLAGS)
129129
debug: HIP_FLAGS = $(HIP_DEBUG_FLAGS)
130130
debug: all
131131

132+
# Profile builds
133+
.PHONY: profile
134+
profile: CUDA_FLAGS = $(CUDA_FLAGS) -lineinfo
135+
profile: HIP_FLAGS = $(HIP_FLAGS) -g
136+
profile: all
137+
132138
# Algorithm-specific targets
133139
.PHONY: sorting
134140
sorting: setup

modules/module8/examples/Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,12 @@ debug: CUDA_FLAGS = $(CUDA_DEBUG_FLAGS)
186186
debug: HIP_FLAGS = $(HIP_DEBUG_FLAGS)
187187
debug: all
188188

189+
# Profile builds
190+
.PHONY: profile
191+
profile: CUDA_FLAGS = $(CUDA_FLAGS) -lineinfo
192+
profile: HIP_FLAGS = $(HIP_FLAGS) -g
193+
profile: all
194+
189195
# Professional builds with maximum optimization
190196
.PHONY: production
191197
production: CUDA_FLAGS += -DNDEBUG -Xptxas -O3

modules/module9/examples/Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,13 @@ debug: HIP_FLAGS = $(HIP_DEBUG_FLAGS)
200200
debug: CXX_FLAGS = -std=c++17 -g -DDEBUG_BUILD
201201
debug: all
202202

203+
# Profile builds
204+
.PHONY: profile
205+
profile: CUDA_FLAGS = $(CUDA_FLAGS) -lineinfo
206+
profile: HIP_FLAGS = $(HIP_FLAGS) -g
207+
profile: CXX_FLAGS += -g -pg
208+
profile: all
209+
203210
# Production builds with security hardening
204211
.PHONY: production
205212
production: CUDA_FLAGS += -DNDEBUG -Xptxas -O3 -DSECURITY_HARDENED

0 commit comments

Comments
 (0)