-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
49 lines (39 loc) · 980 Bytes
/
Makefile
File metadata and controls
49 lines (39 loc) · 980 Bytes
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
# CXXFLAGS = -std=c++17
# CC=g++
#
# # Include directories
# INCLUDE=-I /home/yanis/packages/boost -I ./src
#
# # Library directories and libraries
# # LDFLAGS=-L /home/yanis/packages/tqdm.cpp/build -l tqdmlib
#
# main: main.cpp
# $(CC) $^ -o $@ $(CXXFLAGS) $(INCLUDE) $(LDFLAGS)
#
# Compiler and flags
CC = gcc
CFLAGS = -Wall -Wextra -ggdb -Iinclude
LDFLAGS =
# Directories
SRCDIR = ./csrc
BUILDDIR = ./build
TARGET = main lorenz
# Source and object files
SRC = $(wildcard $(SRCDIR)/*.c) main.c
OBJ = $(patsubst $(SRCDIR)/%.c, $(BUILDDIR)/%.o, $(SRC))
# Main target
all: $(BUILDDIR) $(TARGET)
# Ensure build directory exists
$(BUILDDIR):
mkdir -p $(BUILDDIR)
# Link the final executable
$(TARGET): $(OBJ) $(SRCDIR)/tensor.h
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
# Compile source files into object files
$(BUILDDIR)/%.o: $(SRCDIR)/%.c
$(CC) $(CFLAGS) -c -o $@ $<
# Clean up build artifacts
clean:
rm -f $(BUILDDIR)/*.o $(TARGET)
rmdir $(BUILDDIR)
.PHONY: all clean