# Makefile definitions for building Free Pascal application programs # Copyright (C)2013-2021, Philip Munts, President, Munts AM Corp. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notice, # this list of conditions and the following disclaimer. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. ############################################################################### # Definitions for MuntsOS Embedded Linux ifneq ($(BOARDNAME),) ifeq ($(BOARDBASE),) MUNTSOS ?= /usr/local/share/muntsos include $(MUNTSOS)/include/$(BOARDNAME).mk endif endif ############################################################################### FPC ?= $(FREEPASCALPREFIX)fpc OBJ ?= obj FPC_FLAGS += -Mobjfpc -CX -Sh -Xs -XX -g -gl -FE. -FU$(OBJ) $(FPC_EXTRAFLAGS) ############################################################################### # Check for 64-bit MacOS X ifeq ($(shell uname -s), Darwin) ifeq ($(shell uname -m), x86_64) FPC_FLAGS += -Px86_64 endif endif ############################################################################### # Windows programs need the .EXE file extension ifeq ($(OS),Windows_NT) EXESUFFIX = .exe endif ############################################################################### # Define a pattern rule to compile a Pascal program %: %.pas mkdir -p $(OBJ) $(FPC) $(FPC_FLAGS) $(FPC_LDFLAGS) -o$@$(EXESUFFIX) $^ # We dislike the .pp file extension, but we support it anyway %: %.pp mkdir -p $(OBJ) $(FPC) $(FPC_FLAGS) $(FPC_LDFLAGS) -o$@$(EXESUFFIX) $^ ############################################################################### # Define a pattern rule to compile a Pascal unit %.ppu: %.pas mkdir -p $(OBJ) $(FPC) $(FPC_FLAGS) -o$@ $^ # We dislike the .pp file extension, but we support it anyway %.ppu: %.pp mkdir -p $(OBJ) $(FPC) $(FPC_FLAGS) -o$@ $^ ############################################################################### # Define default target placeholder freepascal_mk_default: default ############################################################################### # Clean out working files freepascal_mk_clean: if [ "$(OBJ)" != "." ]; then rm -rf $(OBJ) ; fi freepascal_mk_reallyclean: freepascal_mk_clean freepascal_mk_distclean: freepascal_mk_reallyclean