CSI-ES-2324/TPs/TP02/c/Makefile

30 lines
516 B
Makefile
Raw Normal View History

2024-02-20 11:48:56 +00:00
CC=gcc
CFLAGS=-Wall -O2
2024-02-20 11:48:56 +00:00
LDFLAGS=-lssl -lcrypto
ARCH=$(shell uname -m)
2024-02-22 01:01:22 +00:00
BIN=bin
SRC=src
2024-02-20 11:48:56 +00:00
ifdef DEBUG
CC=/opt/homebrew/opt/llvm/bin/clang
CFLAGS+= -fsanitize=address -g
endif
2024-02-20 11:48:56 +00:00
ifeq ($(ARCH), arm64)
# Mac ARM installation
CFLAGS+= -I/opt/homebrew/opt/openssl@3.2/include
LDFLAGS+= -L/opt/homebrew/opt/openssl@3.2/lib
endif
2024-02-22 01:01:22 +00:00
SRCS=$(wildcard $(SRC)/*.c)
BINS=$(SRCS:$(SRC)/%.c=%)
2024-02-20 11:48:56 +00:00
2024-02-22 01:01:22 +00:00
all: $(BINS)
%: $(SRC)/%.c
2024-02-20 11:48:56 +00:00
$(info Detected $(ARCH) arquitecture.)
2024-02-22 01:01:22 +00:00
$(CC) $(CFLAGS) $(LDFLAGS) -o $(BIN)/$@ $<
2024-02-20 11:48:56 +00:00
clean:
2024-02-22 01:01:22 +00:00
rm $(BIN)/*