171 lines
5.6 KiB
Makefile
Executable File
171 lines
5.6 KiB
Makefile
Executable File
#!/usr/bin/make -f
|
|
#******************************************************************************#
|
|
# Include configuration #
|
|
#******************************************************************************#
|
|
# Do it
|
|
-include Makefile.cfg
|
|
|
|
# Correct target
|
|
TARGET := $(if $(TARGET),$(TARGET)-)
|
|
|
|
#******************************************************************************#
|
|
# Project main information #
|
|
#******************************************************************************#
|
|
# Project name
|
|
NAME := fontcharacter
|
|
DESCRIPTION := Library for working with CASIO's character encoding
|
|
|
|
# Maintainer information
|
|
MAINTAINER_NAME := Thomas \"Cakeisalie5\" Touhey
|
|
MAINTAINER_MAIL := thomas@touhey.fr
|
|
|
|
# Project version
|
|
MAJOR := 0
|
|
MINOR := 1
|
|
INDEV := y
|
|
|
|
# Project version string
|
|
VERSION := $(MAJOR).$(MINOR)$(if $(INDEV),-indev)
|
|
|
|
#******************************************************************************#
|
|
# Project directories #
|
|
#******************************************************************************#
|
|
# Headers directory - where all the headers are.
|
|
INCDIR := ./include
|
|
|
|
# Sources directory - where all the sources are.
|
|
SRCDIR := ./src
|
|
|
|
# Objects directory - where the objects will be put.
|
|
OBJDIR := ./obj
|
|
|
|
# Documentation directory - where the asciidoc sources for manpages are.
|
|
DOCDIR := ./doc
|
|
|
|
# Manpages directory - where the manpages will be put.
|
|
MANDIR := ./man
|
|
|
|
#******************************************************************************#
|
|
# Object names, libs #
|
|
#******************************************************************************#
|
|
# Dynamic library name
|
|
SONAME := $(if $(FOR_WINDOWS),lib$(NAME).dll,lib$(NAME).so.$(MAJOR))
|
|
SONAMES := lib$(NAME).dll lib$(NAME).so.*
|
|
|
|
# Static library name
|
|
ANAME := $(if $(FOR_WINDOWS),lib$(NAME).lib,lib$(NAME).a)
|
|
ANAMES := lib$(NAME).lib lib$(NAME).a lib$(NAME).dll.a
|
|
|
|
#******************************************************************************#
|
|
# Binary utilities #
|
|
#******************************************************************************#
|
|
# Package configuration
|
|
PKGCONFIG := $(TARGET)pkg-config
|
|
|
|
# C Compiler
|
|
CC := $(TARGET)gcc
|
|
# - Check flags (for warnings enabling)
|
|
CWARN := -Wall -Wextra -Wno-unused-macros -Wno-vla
|
|
# - More flags (for profiling, ...)
|
|
#CMOREFLAGS :=
|
|
# - Check flags (for warnings)
|
|
CWERROR := all extra no-unused-macros no-vla
|
|
ifdef MORE_WARNINGS
|
|
CWERROR += shadow write-strings redundant-decls format format-nonliteral \
|
|
format-security implicit-function-declaration \
|
|
date-time missing-prototypes return-type pointer-arith \
|
|
stack-protector no-unused-parameter
|
|
endif
|
|
CWARN := $(CWERROR:%=-W%)
|
|
# - All of the C compiler flags
|
|
CFLAGS := -I $(INCDIR) $(CWARN) -std=gnu11 \
|
|
$(if $(STATIC),-Dis_static,-fPIC) $(if $(OPTIMIZE_SIZE),-Os,-O2) \
|
|
$(CMOREFLAGS)
|
|
|
|
# Linker
|
|
LD := $(TARGET)gcc
|
|
# - Specific linker flags
|
|
LDFLAGS_Windows := -lws2_32 \
|
|
-Wl,--out-implib,lib$(NAME).dll.a
|
|
LDFLAGS_Linux := $(if $(STATIC),,-Wl,-soname,$(SONAME) \
|
|
-e __lib$(NAME)_version \
|
|
-Wl,-z,relro -Wl,-z,combreloc -Wl,-z,defs)
|
|
# - Linker flags
|
|
LDFLAGS := $(if $(STATIC),,-shared) \
|
|
$(if $(FOR_WINDOWS),$(LDFLAGS_Windows),$(LDFLAGS_Linux)) \
|
|
$(LDMOREFLAGS)
|
|
|
|
# Archive manager
|
|
AR := $(TARGET)ar
|
|
|
|
# Directory maker
|
|
MD := mkdir -p
|
|
# Copier
|
|
CP := cp
|
|
# Mover
|
|
MV := mv
|
|
# Symbolic link maker
|
|
LN := ln -sf
|
|
# File remover
|
|
RM := rm -f
|
|
# Documentation manager (manpages generator)
|
|
A2X := a2x
|
|
# Installer
|
|
INST := install
|
|
# GZipper
|
|
GZIP := gzip -f
|
|
|
|
#******************************************************************************#
|
|
# Look up the sources and includes #
|
|
#******************************************************************************#
|
|
# Look up the sources
|
|
SRC := $(sort $(basename $(shell find $(SRCDIR) -mindepth 1 -type f \
|
|
-name "*.c" -printf "%P\n")) $(if $(NO_REFERENCE),,characters))
|
|
DIRS := $(sort $(dir $(SRC)))
|
|
|
|
# Look up the includes
|
|
INCPUB := $(sort $(shell find $(INCDIR) -name "*.h" -and \
|
|
-not -path "*internals*" -printf "%P\n") lib$(NAME)/characters.h)
|
|
ifeq ($(NO_REFERENCE),y)
|
|
INCPUB := $(filter-out lib$(NAME)/characters.h,$(INCPUB))
|
|
endif
|
|
|
|
# Look up the includes
|
|
INC := $(sort $(shell find $(INCDIR) -name "*.h") \
|
|
$(INCDIR)/lib$(NAME)/characters.h)
|
|
ifeq ($(NO_REFERENCE),y)
|
|
INC := $(filter-out $(INCDIR)/lib$(NAME)/characters.h,$(INC))
|
|
endif
|
|
|
|
#******************************************************************************#
|
|
# Look for manpages #
|
|
#******************************************************************************#
|
|
# Get the manpages sections and contents
|
|
MAN_SECTIONS :=
|
|
define check-man
|
|
MAN_SECTIONS += $1
|
|
MAN_$1 += $2
|
|
endef
|
|
$(foreach doc, $(basename $(shell find $(DOCDIR) \
|
|
-maxdepth 1 -mindepth 1 -printf "%P\n" -type f -or -type l -name "*.*.txt")), \
|
|
$(eval $(call check-man,$(patsubst .%,%,$(suffix $(doc))),$(basename $(doc)))))
|
|
|
|
# Remove duplicate sections.
|
|
MAN_SECTIONS := $(sort $(MAN_SECTIONS))
|
|
|
|
#******************************************************************************#
|
|
# Check for DESTDIR (add as prefix to installation root) #
|
|
#******************************************************************************#
|
|
# Save original library and include dir.
|
|
OIINCDIR := $(IINCDIR)
|
|
OILIBDIR := $(ILIBDIR)
|
|
|
|
# Make it.
|
|
define add-dest-dir
|
|
$1 = $(DESTDIR)$($1)
|
|
endef
|
|
$(if $(DESTDIR), $(foreach idir,IBINDIR ILIBDIR IINCDIR IMANDIR IPKGDIR, \
|
|
$(eval $(call add-dest-dir,$(idir)))))
|
|
|
|
# END OF FILE
|