35 lines
500 B
Makefile
35 lines
500 B
Makefile
|
# Makefile for the add library
|
||
|
# Builds a static library from the add.c file
|
||
|
|
||
|
# Library name
|
||
|
LIB = libadd.a
|
||
|
|
||
|
# Compiler
|
||
|
CC = gcc
|
||
|
|
||
|
# Compiler flags
|
||
|
CFLAGS = -Wall -Werror -Wextra -pedantic
|
||
|
CFLAGS += -std=c99 -O3
|
||
|
|
||
|
# Source file
|
||
|
SRC = add.c
|
||
|
|
||
|
# Object file
|
||
|
OBJ = $(SRC:.c=.o)
|
||
|
|
||
|
# Build the library
|
||
|
$(LIB): $(OBJ)
|
||
|
ar rcs $(LIB) $(OBJ)
|
||
|
|
||
|
# Build the object file
|
||
|
$(OBJ): $(SRC)
|
||
|
$(CC) $(CFLAGS) -c $(SRC)
|
||
|
|
||
|
format:
|
||
|
clang-format -i *.c include/*.h
|
||
|
|
||
|
# Clean the object files
|
||
|
clean:
|
||
|
rm -f $(OBJ)
|
||
|
rm -f $(LIB)
|