Files
otp/Makefile

33 lines
634 B
Makefile

CC = gcc
CFLAGS = -Wall -Wextra -std=c99 -Isrc
LIBS = -lm
LIBS_STATIC = -static -lm
ARCH = $(shell uname -m)
TARGET = build/otp-$(ARCH)
SOURCES = $(wildcard src/*.c)
OBJS = $(SOURCES:.c=.o)
# Default build target
$(TARGET): $(OBJS)
@mkdir -p build
$(CC) $(CFLAGS) -o $(TARGET) $(OBJS) $(LIBS)
# Static linking target
static: $(OBJS)
@mkdir -p build
$(CC) $(CFLAGS) -o $(TARGET) $(OBJS) $(LIBS_STATIC)
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
clean:
rm -f $(OBJS) src/*.o build/otp-* *.pad *.state
install:
sudo cp $(TARGET) /usr/local/bin/otp
uninstall:
sudo rm -f /usr/local/bin/otp
.PHONY: clean install uninstall static