Former-commit-id:8485b90ff8
[formerly bf53d06834caa780226121334ac1bcf0534c3f16] Former-commit-id:9f8cb727a5
88 lines
1.7 KiB
Makefile
88 lines
1.7 KiB
Makefile
.PHONY: link
|
|
#################################################################
|
|
# #
|
|
# PLEASE DO NOT MODIFY THIS FILE. #
|
|
# #
|
|
# link.mk #
|
|
# #
|
|
#################################################################
|
|
#
|
|
# Define BINDIR if not already defined.
|
|
#
|
|
BINDIR ?= $(PREFIX)/bin
|
|
|
|
#
|
|
# MAIN is the 'main' or 'PROGRAM' file name for this directory.
|
|
#
|
|
MAIN := $(filter $(LOCDIR).%, $(CSORCS) $(FSORCS))
|
|
ifeq "$(words $(MAIN))" "0"
|
|
MAIN := $(filter test%, $(CSORCS) $(FSORCS))
|
|
endif
|
|
|
|
#
|
|
# If a 'main' or 'PROGRAM' file exists continue processing.
|
|
#
|
|
ifeq "$(words $(MAIN))" "0"
|
|
|
|
link::
|
|
@echo "No 'main' or 'PROGRAM' module found..."
|
|
|
|
else
|
|
|
|
#
|
|
# Program names, PROGS, are determined from the '.mk' files.
|
|
#
|
|
PROGS := $(notdir $(basename $(wildcard $(SRCDIR)/*.mk)))
|
|
PROGS := $(filter-out cflags, $(PROGS))
|
|
|
|
#
|
|
# Check for the existence of program makefiles (*.mk).
|
|
#
|
|
ifeq "$(words $(PROGS))" "0"
|
|
|
|
#
|
|
# If no program makefiles (*.mk) exist
|
|
# get out of Dodge.
|
|
#
|
|
link::
|
|
@echo "No '*.mk' files found..."
|
|
|
|
else
|
|
|
|
#
|
|
# If program makefiles (*.mk) exist link
|
|
# the programs.
|
|
#
|
|
VPATH += $(LIBDIR) $(OS_LIB)
|
|
|
|
#
|
|
# Include the program specific library dependencies.
|
|
# The include file MUST contain the line:
|
|
# '$(BINDIR)/<program name>: -l....'
|
|
#
|
|
-include $(addprefix $(SRCDIR)/, $(addsuffix .mk, $(PROGS)))
|
|
|
|
link:: $(addprefix $(BINDIR)/, $(PROGS))
|
|
|
|
$(addprefix $(BINDIR)/, $(PROGS)): $(addsuffix .o, $(basename $(MAIN)))
|
|
|
|
@[[ -e $(BINDIR) ]] || mkdir -p $(BINDIR)
|
|
$(FC) $(LDFLAGS) -o $@ $+
|
|
|
|
#
|
|
# Force static files, '.a', to be loaded
|
|
# before shared files, '.so'.
|
|
#
|
|
.LIBPATTERNS = lib%.a lib%.so
|
|
|
|
#
|
|
# library dependencies
|
|
#
|
|
include $(GEMINC)/libdepends.mk
|
|
|
|
endif
|
|
endif
|
|
|
|
#
|
|
# End of link.mk
|
|
#
|