-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
167 lines (152 loc) Β· 7.62 KB
/
Copy pathMakefile
File metadata and controls
167 lines (152 loc) Β· 7.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
# ============================================================================
# PrayTimes Library Makefile
# Ω
ΩΨͺΨ¨Ψ© Ψ£ΩΩΨ§Ψͺ Ψ§ΩΨ΅ΩΨ§Ψ© - Ω
ΩΩ Ψ§ΩΨ¨ΩΨ§Ψ‘
# ============================================================================
# This Makefile provides commands to build, test, and debug the Prayer Times
# library - a C implementation of Dr. Hamid Zarrabi-Zadeh's prayer time
# calculation algorithm.
#
# Main targets:
# - lib : Build the shared library
# - test : Build and run unit tests
# - example : Build example program
# - debug : Build with debugging symbols
# - clean : Remove build artifacts
# ============================================================================
CC = gcc
CFLAGS = -Wall -Wextra -fPIC -lm
DEBUGFLAGS = -g -O0 -DDEBUG
.PHONY: all clean lib test run-test debug help example info ci
# Default target
all: lib
# ============================================================================
# Help target - Display available commands
# ============================================================================
help:
@echo "ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ"
@echo "β PrayTimes Library - Build Commands β"
@echo "ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ"
@echo ""
@echo "Available targets:"
@echo " make lib - Build shared library (bin/libpt.so)"
@echo " make example - Build example program (bin/prayer_times_demo)"
@echo " make test - Build unit test suite (bin/test_libpt)"
@echo " make run-test - Build and run all tests"
@echo " make debug - Build with debug symbols (-g -O0)"
@echo " make ci - Run CI pipeline (clean, build, test)"
@echo " make clean - Remove all build artifacts"
@echo " make info - Show project information"
@echo " make help - Display this help message"
@echo ""
# ============================================================================
# Build shared library target
# ============================================================================
# Builds the Prayer Times library as a shared object (.so file)
# Usage: make lib
lib: bin/libpt.so
bin/libpt.so: src/libpt.c include/libpt.h
@mkdir -p bin/
$(CC) -shared -fPIC -lm -o bin/libpt.so src/libpt.c
@echo "β Library built successfully: bin/libpt.so"
# ============================================================================
# Build example program target
# ============================================================================
# Compiles the example program demonstrating library usage
# Creates: bin/prayer_times_demo
example: bin/prayer_times_demo
bin/prayer_times_demo: examples/prayer_times_demo.c bin/libpt.so include/libpt.h
@mkdir -p bin/
$(CC) $(CFLAGS) -o bin/prayer_times_demo examples/prayer_times_demo.c src/libpt.c
@echo "β Example program built: bin/prayer_times_demo"
# ============================================================================
# Build test suite target
# ============================================================================
# Compiles comprehensive unit tests for the library
# Includes validation tests, calculation tests, and integration tests
# Creates: bin/test_libpt
test: bin/test_libpt
bin/test_libpt: tests/test_libpt.c src/libpt.c include/libpt.h
@mkdir -p bin/
$(CC) $(CFLAGS) -o bin/test_libpt tests/test_libpt.c src/libpt.c
@echo "β Test suite built successfully: bin/test_libpt"
# ============================================================================
# Run tests target
# ============================================================================
# Builds and executes the test suite
# Displays detailed test results and pass/fail statistics
run-test: test
@echo ""
@echo "ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ"
@echo "β Running Prayer Times Library - Comprehensive Unit Tests β"
@echo "ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ"
@echo ""
@./bin/test_libpt
# ============================================================================
# Debug build target
# ============================================================================
# Creates debug version with symbols and optimizations disabled
# Useful for GDB debugging and detailed error reporting
# Flags: -g (symbols), -O0 (no optimization), -DDEBUG (preprocessor define)
debug: CFLAGS += $(DEBUGFLAGS)
debug: clean lib test
@echo ""
@echo "β Debug build complete with symbols"
@echo " Use: gdb ./bin/test_libpt"
# ============================================================================
# Clean target
# ============================================================================
# Removes all build artifacts and temporary files
# Cleans: bin/ directory
clean:
@rm -rf bin/
@echo "β All build artifacts cleaned"
# ============================================================================
# CI Pipeline target
# ============================================================================
# Runs complete continuous integration pipeline:
# 1. Clean all previous builds
# 2. Build the library
# 3. Build unit tests
# 4. Run all tests
# Useful for automated testing and deployment verification
ci: clean lib test run-test
@echo ""
@echo "β CI pipeline complete - all checks passed"
# ============================================================================
# Info target
# ============================================================================
# Displays project information and structure
info:
@echo ""
@echo "ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ"
@echo "β PrayTimes Library v1.0 β"
@echo "ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ"
@echo ""
@echo "Description:"
@echo " Calculates Islamic prayer times based on geographical location"
@echo " and astronomical calculations by Dr. Hamid Zarrabi-Zadeh"
@echo ""
@echo "Supported Calculation Methods:"
@echo " 1. Umm Al-Qura University (Ψ¬Ψ§Ω
ΨΉΨ© Ψ£Ω
Ψ§ΩΩΨ±Ω)"
@echo " 2. Muslim World League (Ψ±Ψ§Ψ¨Ψ·Ψ© Ψ§ΩΨΉΨ§ΩΩ
Ψ§ΩΨ₯Ψ³ΩΨ§Ω
Ω)"
@echo " 3. Islamic Society of North America (Ψ¬Ω
ΨΉΩΨ© Ψ₯Ψ³ΩΨ§Ω
ΩΨ©)"
@echo " 4. Egyptian General Authority (Ψ§ΩΩΩΨ¦Ψ© Ψ§ΩΩ
Ψ΅Ψ±ΩΨ©)"
@echo " 5. Karachi Islamic University (Ψ¬Ψ§Ω
ΨΉΨ© ΩΨ±Ψ§ΨͺΨ΄Ω)"
@echo ""
@echo "Juristic Schools:"
@echo " β’ Standard (Shafi'i, Maliki, Hanbali)"
@echo " β’ Hanafi"
@echo ""
@echo "Project Structure:"
@echo " include/ - Header files (libpt.h)"
@echo " src/ - Library source code (libpt.c)"
@echo " tests/ - Test suite and examples"
@echo " bin/ - Compiled output (created after make lib)"
@echo ""
@echo "Quick Start:"
@echo " 1. make lib - Build the library"
@echo " 2. make example - Compile and run example"
@echo " 3. make run-test - Run unit tests"
@echo ""
@echo "License: MIT / Public Domain"
@echo ""