2016-05-22 23:43:10 +02:00
|
|
|
|
#!/usr/bin/make -f
|
2016-04-21 22:27:29 +02:00
|
|
|
|
#******************************************************************************#
|
|
|
|
|
# #
|
|
|
|
|
# Makefile #
|
2016-04-22 07:06:40 +02:00
|
|
|
|
# | Project : libmonochrome #
|
2016-04-21 22:27:29 +02:00
|
|
|
|
# #
|
|
|
|
|
# By: thomas <thomas@touhey.fr> #
|
|
|
|
|
# Last updated: 2015/12/23 10:02:49 #
|
|
|
|
|
# #
|
|
|
|
|
#******************************************************************************#
|
|
|
|
|
# INCLUDE CONFIGURATION
|
2016-05-30 13:16:12 +02:00
|
|
|
|
include Makefile.vars Makefile.cfg
|
2016-04-21 22:27:29 +02:00
|
|
|
|
|
|
|
|
|
# DEDUCED VARIABLES
|
|
|
|
|
ALLOBJ = $(SRC:%=$(OBJDIR)/%.o)
|
2016-05-22 23:13:11 +02:00
|
|
|
|
ALLINC = $(INCPUB:%=$(INCDIR)/%.h) $(INCINT:%=$(INCDIR)/%.h)
|
2016-05-09 02:16:52 +02:00
|
|
|
|
|
|
|
|
|
# STYLE VARS
|
|
|
|
|
define \n
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
endef
|
2016-04-21 22:27:29 +02:00
|
|
|
|
|
|
|
|
|
# RULES
|
2016-07-18 14:17:23 +02:00
|
|
|
|
## General
|
|
|
|
|
## - Make everything (default)
|
2016-04-21 22:27:29 +02:00
|
|
|
|
all: lib$(NAME).a
|
|
|
|
|
|
2016-07-18 14:17:23 +02:00
|
|
|
|
## Library related
|
|
|
|
|
## - Make the object directory
|
2016-04-21 22:27:29 +02:00
|
|
|
|
$(OBJDIR):
|
2016-07-18 14:17:23 +02:00
|
|
|
|
$(MD) $@
|
2016-04-21 22:27:29 +02:00
|
|
|
|
|
2016-07-18 14:17:23 +02:00
|
|
|
|
## - Make an object file out of a C source file
|
2016-04-22 00:43:28 +02:00
|
|
|
|
$(OBJDIR)/%.o: $(SRCDIR)/%.c $(ALLINC)
|
2016-04-21 22:27:29 +02:00
|
|
|
|
$(CC) -c -o $@ $< $(CFLAGS)
|
|
|
|
|
|
2016-07-18 14:17:23 +02:00
|
|
|
|
## - Make the library
|
2016-04-21 22:27:29 +02:00
|
|
|
|
lib$(NAME).a: $(OBJDIR) $(ALLOBJ)
|
2016-04-26 12:05:45 +02:00
|
|
|
|
$(AR) rc $@ $(ALLOBJ)
|
2016-04-21 22:27:29 +02:00
|
|
|
|
$(RANLIB) $@
|
|
|
|
|
|
2016-07-18 14:17:23 +02:00
|
|
|
|
## - Clean the object files
|
2016-04-21 22:27:29 +02:00
|
|
|
|
clean:
|
|
|
|
|
$(RM) $(ALLOBJ)
|
|
|
|
|
|
2016-07-18 14:17:23 +02:00
|
|
|
|
## - Clean the object files and the binary
|
2016-04-21 22:27:29 +02:00
|
|
|
|
fclean: clean
|
|
|
|
|
$(RM) lib$(NAME).a
|
|
|
|
|
|
2016-07-18 14:17:23 +02:00
|
|
|
|
## - Remake the library
|
2016-04-21 22:27:29 +02:00
|
|
|
|
re: fclean all
|
|
|
|
|
|
2016-07-18 14:17:23 +02:00
|
|
|
|
## - Install library and includes
|
2016-05-22 23:13:11 +02:00
|
|
|
|
install:
|
|
|
|
|
$(INST) -D -m 644 lib$(NAME).a $(ILIBDIR)/lib$(NAME).a
|
|
|
|
|
$(foreach inc, $(INCPUB), \
|
|
|
|
|
$(INST) -D -m 644 $(INCDIR)/$(inc).h $(IINCDIR)/$(inc).h$(\n))
|
2016-07-18 14:17:23 +02:00
|
|
|
|
|
|
|
|
|
## Documentation related
|
|
|
|
|
## - Make man directories
|
|
|
|
|
define make-mandir-rule
|
|
|
|
|
$(MANDIR)/man$1:
|
|
|
|
|
$(MD) $$@
|
|
|
|
|
endef
|
|
|
|
|
$(foreach section,$(MAN_SECTS), \
|
|
|
|
|
$(eval $(call make-mandir-rule,$(section))))
|
|
|
|
|
|
|
|
|
|
## - Make-A-Manpage
|
|
|
|
|
define make-manpage-rule
|
|
|
|
|
$(MANDIR)/man$1/$2.$1: $(DOCDIR)/$2.$1.txt | $(MANDIR)/man$1
|
|
|
|
|
$(A2X) -f manpage -D $$| $$<
|
|
|
|
|
endef
|
|
|
|
|
$(foreach section,$(MAN_SECTS), \
|
|
|
|
|
$(foreach page,$(MAN_$(section)), \
|
|
|
|
|
$(eval $(call make-manpage-rule,$(section),$(page)))))
|
|
|
|
|
|
|
|
|
|
## - Make all manpages
|
|
|
|
|
all-doc: $(foreach section,$(MAN_SECTS),$(MAN_$(section):%=$(MANDIR)/man$(section)/%.$(section)))
|
|
|
|
|
|
|
|
|
|
## - Clean all manpages
|
|
|
|
|
clean-doc:
|
|
|
|
|
$(RM) $(foreach section,$(MAN_SECTS),$(MAN_$(section):%=$(MANDIR)/man$(section)/%.$(section)))
|
|
|
|
|
|
|
|
|
|
## Install doc
|
|
|
|
|
install-doc:
|
2016-05-22 23:13:11 +02:00
|
|
|
|
$(foreach man, $(MAN), \
|
|
|
|
|
$(INST) -D -m 644 $(MANDIR)/$(man) $(IMANDIR)/$(man)$(\n))
|
|
|
|
|
$(GZIP) $(MAN:%=$(IMANDIR)/%)
|
2016-05-18 19:55:20 +02:00
|
|
|
|
|
2016-04-21 22:27:29 +02:00
|
|
|
|
## Doz rulz are phunny
|
2016-05-22 23:13:11 +02:00
|
|
|
|
.PHONY: all clean fclean re install
|
2016-07-18 14:17:23 +02:00
|
|
|
|
.PHONY: all-doc install-doc
|
2016-04-21 22:27:29 +02:00
|
|
|
|
|
|
|
|
|
# END OF FILE
|