aisl/tool/Makefile

89 lines
1.4 KiB
Makefile
Raw Permalink Normal View History

#
# Makefile
# Ilja Kartašov, 2019-07-13 14:51
#
.POSIX:
CC ?= gcc
PKG_CONFIG ?= pkg-config
PREFIX ?= /usr/local
DESTDIR ?=
BIN_DIR ?= bin
TARGET_NAME = aisl
OUT_DIR ?= ../build
SRC_DIR ?= .
SDK_DIR ?= ../sdk
CSTUFF_DIR ?= ../cStuff
# Version
VERSION_MAJOR = 0
VERSION_MINOR = 1
VERSION_TWEAK = 0
VERSION_LABEL = 0
# Source files
SOURCE_FILES := \
$(SRC_DIR)/main.c \
$(SRC_DIR)/option.c \
$(SRC_DIR)/compose.c \
\
$(SDK_DIR)/components/html.c \
\
$(CSTUFF_DIR)/list.c \
$(CSTUFF_DIR)/string.c \
# compilation macro options:
CFLAGS := \
-std=c99 \
-pedantic \
-Wall \
-Wmissing-prototypes \
-Wstrict-prototypes \
-Wold-style-definition \
-O2 \
-s \
\
-I../ \
-I$(SDK_DIR) \
\
-D_POSIX_C_SOURCE=200809L \
-DEXECUTABLE="$(TARGET_NAME)" \
-DVERSION_MAJOR=$(VERSION_MAJOR) \
-DVERSION_MINOR=$(VERSION_MINOR) \
-DVERSION_TWEAK=$(VERSION_TWEAK) \
-DVERSION_LABEL=$(VERSION_LABEL) \
\
$(CFLAGS) \
LDFLAGS :=
# flags
SOURCE_LIST := $(wildcard $(SOURCE_FILES))
OBJECT_LIST := $(addsuffix .o, $(addprefix $(OUT_DIR)/tool/, ${SOURCE_LIST}))
all: $(TARGET_NAME)
$(TARGET_NAME): $(OBJECT_LIST)
$(info building target: $@)
@$(CC) -o $(OUT_DIR)/$@ $(OBJECT_LIST) $(LDFLAGS)
$(info done: $@)
$(OUT_DIR)/tool/%.o: %
$(info compiling file: $<)
@mkdir -p $(dir $@)
@$(CC) $(CFLAGS) -c $< -o $@
install: $(TARGET_NAME)
$(info installing files)
@cp $(OUT_DIR)/$< $(DESTDIR)$(PREFIX)/$(BIN_DIR)
# vim:ft=make
#