-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathMakefile.darwin
More file actions
74 lines (54 loc) · 1.97 KB
/
Copy pathMakefile.darwin
File metadata and controls
74 lines (54 loc) · 1.97 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
# Makefile for binica - Darwin (macOS) platform
# Uses Apple Accelerate framework for BLAS/LAPACK
# Directories
SRCDIR = src
INCDIR = include
OBJDIR = obj
# Compiler and flags
CC = gcc
CFLAGS = -O3 -I$(INCDIR)
LIBS = -framework Accelerate -lm
# Source files
SRCS = $(SRCDIR)/ica.c $(SRCDIR)/interfc.c $(SRCDIR)/memap.c \
$(SRCDIR)/r250.c $(SRCDIR)/randlcg.c $(SRCDIR)/dsum.c
# Object files (in obj/ directory)
OBJS = $(OBJDIR)/ica.o $(OBJDIR)/interfc.o $(OBJDIR)/memap.o \
$(OBJDIR)/r250.o $(OBJDIR)/randlcg.o $(OBJDIR)/dsum.o
# Headers
HEADERS = $(INCDIR)/ica.h $(INCDIR)/memap.h $(INCDIR)/r250.h $(INCDIR)/randlcg.h
# Target executable (at root)
TARGET = ica_darwin
# Default target
all: $(OBJDIR) $(TARGET)
# Create obj directory if it doesn't exist
$(OBJDIR):
mkdir -p $(OBJDIR)
# Link executable
$(TARGET): $(OBJS)
$(CC) -o $(TARGET) $(OBJS) $(LIBS)
# Compile source files
$(OBJDIR)/ica.o: $(SRCDIR)/ica.c $(INCDIR)/ica.h $(INCDIR)/memap.h $(INCDIR)/r250.h
$(CC) -c $(SRCDIR)/ica.c -o $(OBJDIR)/ica.o $(CFLAGS)
$(OBJDIR)/interfc.o: $(SRCDIR)/interfc.c $(INCDIR)/ica.h $(INCDIR)/memap.h
$(CC) -c $(SRCDIR)/interfc.c -o $(OBJDIR)/interfc.o $(CFLAGS)
$(OBJDIR)/memap.o: $(SRCDIR)/memap.c $(INCDIR)/memap.h
$(CC) -c $(SRCDIR)/memap.c -o $(OBJDIR)/memap.o $(CFLAGS)
$(OBJDIR)/r250.o: $(SRCDIR)/r250.c $(INCDIR)/r250.h $(INCDIR)/randlcg.h
$(CC) -c $(SRCDIR)/r250.c -o $(OBJDIR)/r250.o $(CFLAGS)
$(OBJDIR)/randlcg.o: $(SRCDIR)/randlcg.c $(INCDIR)/randlcg.h
$(CC) -c $(SRCDIR)/randlcg.c -o $(OBJDIR)/randlcg.o $(CFLAGS)
$(OBJDIR)/dsum.o: $(SRCDIR)/dsum.c
$(CC) -c $(SRCDIR)/dsum.c -o $(OBJDIR)/dsum.o $(CFLAGS)
# Clean build artifacts
clean:
rm -f $(OBJDIR)/*.o $(TARGET)
# Clean everything including directories
distclean: clean
rm -rf $(OBJDIR)
# Install (optional)
install: $(TARGET)
cp $(TARGET) /usr/local/bin/
# Uninstall (optional)
uninstall:
rm -f /usr/local/bin/$(TARGET)
.PHONY: all clean distclean install uninstall