view mk/hostprog.mk @ 4:bebb2ba69e1d

maybe help with getting tex to fail properly on error
author David A. Holland
date Sat, 18 Apr 2020 17:12:17 -0400
parents 13d2b8934445
children bb115deb6fb2
line wrap: on
line source

#
# hostprog.mk - build a program on the cross-compile host, in portable make.
#
# Before including, set:
#    PROG                        program to build
#    SRCS                        sources
#    SYNS (optional)             AG syntax files
#    SYNOUTPUTEXT (optional)     output suffix for AG files
#    AGFILEDEST (optional)       destination for AG files ("here" or "srcdir")
#

SYNOUTPUTEXT?=.cpp
AGFILEDEST?=srcdir

include $(BUILDTOP)/config.mk

# beforeall used by: none
# afterall used by: none

all: beforeall doall afterall
beforeall afterall:;
doall: $(PROG)

# BSD make has .WAIT to make beforeall/afterall work, but gmake doesn't.
.NOTPARALLEL:

include rules.mk
include depend.mk

$(PROG)$(HOST_EXEEXT): $(OBJS)
	@echo '        [DEP]'
	@$(HOST_MKDEP)
	@echo '        [LINK]    $(PROG)$(HOST_EXEEXT)'
	@$(HOST_LDCC) $(HOST_LDFLAGS) $(OBJS) $(HOST_LIBS) -o $@

rules:
	@$(TOP)/mk/hostprog-rules.sh '$(SRCS)' > rules.mk
	@$(TOP)/mk/agfile-rules.sh $(AGFILEDEST) '$(SYNS)' '$(SYNOUTPUTEXT)' \
	    >> rules.mk
#	@echo '        [RULES]'

depend:
	@echo '        [DEP]'
	@$(HOST_MKDEP)

clean distclean:
	@echo '        [RM]      $(PROG)$(HOST_EXEEXT) $(HOST_CLEANFILES) *~'
	@rm -f $(PROG)$(HOST_EXEEXT) $(HOST_CLEANFILES) *~

.PHONY: all depend clean distclean
.PHONY: beforeall doall afterall