2024-04-02 04:36:16 +00:00
|
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
# ******************************************************************************
|
|
|
|
|
#
|
|
|
|
|
# @file Makefile
|
|
|
|
|
#
|
|
|
|
|
# @brief Makefile for Array Utility Function library
|
|
|
|
|
#
|
|
|
|
|
# @copyright Copyright (C) 2024 Jackrabbit Founders LLC. All rights reserved.
|
|
|
|
|
#
|
|
|
|
|
# @date Mar 2024
|
|
|
|
|
# @author Barrett Edwards <code@jrlabs.io>
|
|
|
|
|
#
|
|
|
|
|
# ******************************************************************************
|
|
|
|
|
|
2024-03-28 23:31:26 +00:00
|
|
|
CC=gcc
|
2024-04-08 05:39:40 +00:00
|
|
|
CFLAGS?= -g3 -O0 -Wall -Wextra
|
|
|
|
|
MACROS?=
|
|
|
|
|
INCLUDE_DIR?=/usr/local/include
|
|
|
|
|
LIB_DIR?=/usr/local/lib
|
2024-03-28 23:31:26 +00:00
|
|
|
INCLUDE_PATH=-I $(INCLUDE_DIR)
|
|
|
|
|
LIB_PATH=-L $(LIB_DIR)
|
|
|
|
|
LIBS=
|
2024-04-02 04:36:16 +00:00
|
|
|
TARGET=arrayutils
|
2024-03-28 23:31:26 +00:00
|
|
|
|
2024-04-08 05:39:40 +00:00
|
|
|
all: lib$(TARGET).a
|
2024-03-28 23:31:26 +00:00
|
|
|
|
2024-04-02 04:36:16 +00:00
|
|
|
testbench: testbench.c main.o
|
|
|
|
|
$(CC) $^ $(CFLAGS) $(MACROS) $(INCLUDE_PATH) $(LIB_PATH) $(LIBS) -o $@
|
2024-03-28 23:31:26 +00:00
|
|
|
|
2024-04-02 04:36:16 +00:00
|
|
|
lib$(TARGET).a: main.o
|
2024-03-28 23:31:26 +00:00
|
|
|
ar rcs $@ $^
|
|
|
|
|
|
2024-04-02 04:36:16 +00:00
|
|
|
main.o: main.c main.h
|
|
|
|
|
$(CC) -c $< $(CFLAGS) $(MACROS) $(INCLUDE_PATH) -o $@
|
2024-03-28 23:31:26 +00:00
|
|
|
|
|
|
|
|
clean:
|
|
|
|
|
rm -rf ./*.o ./*.a testbench
|
|
|
|
|
|
2024-04-02 04:36:16 +00:00
|
|
|
doc:
|
|
|
|
|
doxygen
|
|
|
|
|
|
|
|
|
|
install: lib$(TARGET).a
|
|
|
|
|
sudo cp lib$(TARGET).a $(LIB_DIR)/
|
|
|
|
|
sudo cp main.h $(INCLUDE_DIR)/$(TARGET).h
|
2024-03-28 23:31:26 +00:00
|
|
|
|
2024-04-08 05:39:40 +00:00
|
|
|
uninstall:
|
|
|
|
|
sudo rm $(LIB_DIR)/lib$(TARGET).a
|
|
|
|
|
sudo rm $(INCLUDE_DIR)/$(TARGET).h
|
|
|
|
|
|
|
|
|
|
.PHONY: all clean doc install uninstall
|
2024-03-28 23:31:26 +00:00
|
|
|
|
|
|
|
|
# Variables
|
|
|
|
|
# $^ Will expand to be all the sensitivity list
|
|
|
|
|
# $< Will expand to be the frist file in sensitivity list
|
|
|
|
|
# $@ Will expand to be the target name (the left side of the ":" )
|
|
|
|
|
# -c gcc will compile but not try and link
|