cake
/
libg1m
Archived
1
0
Fork 0
This repository has been archived on 2024-03-16. You can view files and clone it, but cannot push or open issues or pull requests.
libg1m/Makefile.vars

169 lines
5.5 KiB
Makefile
Raw Normal View History

2016-10-30 20:18:15 +01:00
#!/usr/bin/make -f
#******************************************************************************#
# Include configuration #
#******************************************************************************#
# Do it
2016-10-30 20:18:15 +01:00
-include Makefile.cfg
# Correct target
TARGET := $(if $(TARGET),$(TARGET)-)
2016-10-30 20:18:15 +01:00
#******************************************************************************#
# Project main information #
#******************************************************************************#
2016-12-20 21:59:26 +01:00
# Project name and description
2016-10-30 20:18:15 +01:00
NAME := g1m
2016-12-20 21:59:26 +01:00
DESCRIPTION := Library for reading and writing CASIO files
2016-10-30 20:18:15 +01:00
2016-12-31 11:37:13 +01:00
# Maintainer information
MAINTAINER_NAME := Thomas \"Cakeisalie5\" Touhey
MAINTAINER_MAIL := thomas@touhey.fr
2016-10-30 20:18:15 +01:00
# Project version
2016-11-19 12:05:54 +01:00
MAJOR := 0
MINOR := 1
2016-10-30 20:18:15 +01:00
INDEV := yes
2017-01-27 21:49:04 +01:00
# Project version string
2016-11-19 12:05:54 +01:00
VERSION := $(MAJOR).$(MINOR)$(if $(INDEV),-indev)
2016-10-30 20:18:15 +01:00
#******************************************************************************#
# 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 the manpages are.
DOCDIR := ./doc
# Manpages directory - where the manpages will be put.
MANDIR := ./man
#******************************************************************************#
# Object names #
#******************************************************************************#
# Dynamic library name
2016-12-20 17:29:54 +01:00
SONAME := $(if $(FOR_WINDOWS),lib$(NAME).dll,lib$(NAME).so.$(MAJOR))
SONAMES := $(if $(FOR_WINDOWS),lib$(NAME).dll,lib$(NAME).so.*)
2017-01-27 21:49:04 +01:00
# Static library name
ANAME := $(if $(FOR_WINDOWS),lib$(NAME).lib,lib$(NAME).a)
ANAMES := lib$(NAME).lib lib$(NAME).a lib$(NAME).dll.a
# Libs
DEPS := libfontcharacter
DEPS_PRIV := zlib
ALLDEPS := $(DEPS) $(DEPS_PRIV)
2017-01-27 21:49:04 +01:00
2016-10-30 20:18:15 +01:00
#******************************************************************************#
# Binary utilities #
#******************************************************************************#
2016-12-21 16:39:26 +01:00
# Package configuration
PKGCONFIG := $(TARGET)pkg-config
2016-10-30 20:18:15 +01:00
# Compiler
CC := $(TARGET)gcc
2016-10-30 20:18:15 +01:00
# - Check flags (warnings)
CWERROR := all extra no-attributes no-unused-macros no-vla no-multichar
2017-01-27 21:49:04 +01:00
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%)
2016-10-30 20:18:15 +01:00
# - For random manipulations (profiling, ...)
2017-01-27 21:49:04 +01:00
#CMOREFLAGS :=
2016-10-30 20:18:15 +01:00
# - All C compiling flags
2017-01-27 21:49:04 +01:00
CFLAGS := -I $(INCDIR) $(CWARN) -std=gnu11 \
$(if $(STATIC),,-fPIC) $(if $(OPTIMIZE_SIZE),-Os,-O2) \
-D LOGLEVEL="ll_$(LOG_LEVEL)" \
$(shell $(PKGCONFIG) --cflags $(ALLDEPS) 2>/dev/null) \
2016-10-30 20:18:15 +01:00
$(CMOREFLAGS)
# Linker
LD := $(TARGET)gcc
# - Specific linker flags
2017-01-27 21:49:04 +01:00
LDFLAGS_Windows := -lws2_32 -Wl,--out-implib,lib$(NAME).dll.a
LDFLAGS_Linux := $(if $(STATIC),,-Wl,-soname,$(SONAME) \
-e $(NAME)__version \
2017-01-27 21:49:04 +01:00
-Wl,-z,relro -Wl,-z,combreloc -Wl,-z,defs)
# - Linker flags
2017-01-27 21:49:04 +01:00
LDFLAGS := $(if $(STATIC),,-shared) \
$(shell $(PKGCONFIG) --libs $(ALLDEPS) 2>/dev/null) -lm \
2017-01-27 21:49:04 +01:00
$(if $(FOR_WINDOWS),$(LDFLAGS_Windows),$(LDFLAGS_Linux)) \
$(LDMOREFLAGS)
# Archive manager
AR := $(TARGET)ar
2016-10-30 20:18:15 +01:00
# Directory maker
MD := mkdir -p
# Copier
CP := cp
# Mover
MV := mv
2016-10-30 20:18:15 +01:00
# Symbolic link maker
LN := ln -sf
# File remover
RM := rm -f
# Documentation creator
A2X := a2x
# Installer
INST := install
# GZipper
GZIP := gzip -f
#******************************************************************************#
2017-02-28 15:01:21 +01:00
# Look up the sources and includes #
2016-10-30 20:18:15 +01:00
#******************************************************************************#
2017-02-28 15:01:21 +01:00
# Look up the sources
SRC := $(basename $(shell find $(SRCDIR) -mindepth 1 -type f \
-name "*.c" -printf "%P\n"))
DIRS := $(sort $(dir $(SRC)))
2016-10-30 20:18:15 +01:00
2017-02-28 15:01:21 +01:00
# Look up the includes
INCPUB := $(shell find $(INCDIR) -name "*.h" -and \
-not -path "*internals*" -printf "%P\n")
2017-01-27 21:49:04 +01:00
2017-02-28 15:01:21 +01:00
# Look up the includes
2017-01-27 21:49:04 +01:00
INC := $(shell find $(INCDIR) -name "*.h")
2016-10-30 20:18:15 +01:00
#******************************************************************************#
# 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) #
#******************************************************************************#
2016-12-20 21:59:26 +01:00
# Save original library and include dir.
OIINCDIR := $(IINCDIR)
OILIBDIR := $(ILIBDIR)
# Make it.
2016-10-30 20:18:15 +01:00
define add-dest-dir
$1 = $(DESTDIR)$($1)
endef
$(if $(DESTDIR), $(foreach idir,\
IBINDIR IPKGDIR ILIBDIR IINCDIR IMANDIR HBINDIR, \
2016-10-30 20:18:15 +01:00
$(eval $(call add-dest-dir,$(idir)))))
# END OF FILE