-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
52 lines (39 loc) · 913 Bytes
/
Makefile
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
CC=gcc
CFLAGS=-Wall -std=c99 -g -O3 -I./include
LDFLAGS=
OBJDIR=./obj
BINDIR=./bin
SRCDIR=./src
INCDIR=./include
# Object files
OBJS=$(OBJDIR)/utils.o $(OBJDIR)/lat.o\
$(OBJDIR)/toy_cipher3.o \
$(OBJDIR)/main.o
# Executable
TARGET=$(BINDIR)/a.out
# Phony Targets
.PHONY: all clean dir rebuild
# Default target
all: dir $(TARGET)
# Rule for building the final target
$(TARGET): $(OBJS)
$(CC) -o $@ $^ $(LDFLAGS)
# Rule for compiling source files to object files
$(OBJDIR)/%.o: $(SRCDIR)/%.c
$(CC) $(CFLAGS) -MMD -MP -c $< -o $@
# Include automatically generated dependencies
-include $(OBJS:.o=.d)
# Clean up
clean:
rm -f $(OBJS) $(TARGET) $(OBJDIR)/*.d
rm -f ./view/*.txt
# Create necessary directories
dir:
@mkdir -p $(OBJDIR) $(BINDIR)
rebuild: clean all
run:
(cd bin && ./a.out)
lat:
(cd bin && ./a.out > SBOX_LAT.txt)
(cd bin && mv SBOX_LAT.txt ../view/)
(cd view && python3 lat.py)