-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
53 lines (39 loc) · 1.08 KB
/
Makefile
File metadata and controls
53 lines (39 loc) · 1.08 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
# Makefile for disccofan project
# Compilers
CC = gcc
CXX = g++
MPICC = mpicc
MPICXX = mpicxx
# Compiler Flags
CFLAGS = -O3 -fopenmp -pedantic -Wall
CXXFLAGS = -std=c++11 -O3 -fopenmp -pedantic -Wall
# Directories
SRC_DIR = src/sources
INC_DIR = src/headers
OBJ_DIR = obj
# Libraries
LIBS = -fopenmp -lfreeimage -lhdf5 -lcfitsio -lconfig -lm
MPI_LIBS = $(shell $(MPICXX) -showme:link)
# Include directories
INCLUDES = -I$(INC_DIR) -I/usr/include/cfitsio -I/usr/include
MPI_INCLUDES = $(shell $(MPICXX) -showme:compile)
# Source and Object files
SOURCES = $(wildcard $(SRC_DIR)/*.c)
OBJECTS = $(patsubst $(SRC_DIR)/%.c, $(OBJ_DIR)/%.o, $(SOURCES))
# Executable
TARGET = disccofan
# Create directories if they do not exist
$(OBJ_DIR):
mkdir -p $(OBJ_DIR)
# Build target
$(TARGET): $(OBJ_DIR) $(OBJECTS)
$(MPICC) $(OBJECTS) -o $(TARGET) $(LIBS) $(MPI_LIBS)
# Build object files
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c | $(OBJ_DIR)
$(MPICC) $(CFLAGS) $(INCLUDES) $(MPI_INCLUDES) -c $< -o $@
# Clean
clean:
rm -rf $(OBJ_DIR) $(TARGET)
.PHONY: clean
# Debugging information
print-%: ; @echo $* = $($*)