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

24 lines
436 B
Makefile

CC=gcc
CFLAGS=-Wall -Wextra -O2
LDFLAGS=-lssl -lcrypto
ARCH=$(shell uname -m)
BIN=bin
SRC=src
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
SRCS=$(wildcard $(SRC)/*.c)
BINS=$(SRCS:$(SRC)/%.c=%)
all: $(BINS)
%: $(SRC)/%.c
$(info Detected $(ARCH) arquitecture.)
$(CC) $(CFLAGS) $(LDFLAGS) -o $(BIN)/$@ $<
clean:
rm $(BIN)/*