32 lines
592 B
Makefile
32 lines
592 B
Makefile
# Detect the operating system
|
|
ifeq ($(OS),Windows_NT)
|
|
MKDIR = if not exist $(LIB_DIR) mkdir $(LIB_DIR)
|
|
RM = del
|
|
else
|
|
MKDIR = mkdir -p $(LIB_DIR)
|
|
RM = rm -f
|
|
endif
|
|
|
|
CC = gcc
|
|
AR = ar
|
|
CFLAGS = -Wall -fPIC
|
|
SRC_DIR = src
|
|
LIB_DIR = lib
|
|
SRC_FILES = $(wildcard $(SRC_DIR)/*.c)
|
|
OBJ_FILES = $(SRC_FILES:$(SRC_DIR)/%.c=$(LIB_DIR)/%.o)
|
|
STATIC_LIB = $(LIB_DIR)/libp4pillondebuglib.a
|
|
|
|
all: $(STATIC_LIB)
|
|
|
|
$(STATIC_LIB): $(OBJ_FILES)
|
|
$(MKDIR)
|
|
$(AR) rcs $@ $^
|
|
|
|
$(LIB_DIR)/%.o: $(SRC_DIR)/%.c
|
|
$(MKDIR)
|
|
$(CC) $(CFLAGS) -c $< -o $@
|
|
|
|
clean:
|
|
$(RM) $(OBJ_FILES) $(STATIC_LIB)
|
|
|
|
.PHONY: all clean |