1*6eef5f0cSAntonio Huete Jimenez# $Id: init.mk,v 1.27 2022/01/01 17:32:18 sjg Exp $ 25f1e34d9SAlexandre Perrin# 35f1e34d9SAlexandre Perrin# @(#) Copyright (c) 2002, Simon J. Gerraty 45f1e34d9SAlexandre Perrin# 55f1e34d9SAlexandre Perrin# This file is provided in the hope that it will 65f1e34d9SAlexandre Perrin# be of use. There is absolutely NO WARRANTY. 75f1e34d9SAlexandre Perrin# Permission to copy, redistribute or otherwise 85f1e34d9SAlexandre Perrin# use this file is hereby granted provided that 95f1e34d9SAlexandre Perrin# the above copyright notice and this notice are 105f1e34d9SAlexandre Perrin# left intact. 115f1e34d9SAlexandre Perrin# 125f1e34d9SAlexandre Perrin# Please send copies of changes and bug-fixes to: 135f1e34d9SAlexandre Perrin# sjg@crufty.net 145f1e34d9SAlexandre Perrin# 155f1e34d9SAlexandre Perrin 165f1e34d9SAlexandre Perrin.if !target(__${.PARSEFILE}__) 17*6eef5f0cSAntonio Huete Jimenez__${.PARSEFILE}__: .NOTMAIN 185f1e34d9SAlexandre Perrin 195f1e34d9SAlexandre Perrin.if ${MAKE_VERSION:U0} > 20100408 205f1e34d9SAlexandre Perrin_this_mk_dir := ${.PARSEDIR:tA} 215f1e34d9SAlexandre Perrin.else 225f1e34d9SAlexandre Perrin_this_mk_dir := ${.PARSEDIR} 235f1e34d9SAlexandre Perrin.endif 245f1e34d9SAlexandre Perrin 255f1e34d9SAlexandre Perrin.-include <local.init.mk> 26f445c897SJohn Marino.-include <${.CURDIR:H}/Makefile.inc> 275f1e34d9SAlexandre Perrin.include <own.mk> 28ca58f742SDaniel Fojt.include <compiler.mk> 295f1e34d9SAlexandre Perrin 305f1e34d9SAlexandre Perrin.MAIN: all 315f1e34d9SAlexandre Perrin 32f445c897SJohn Marino# should have been set by sys.mk 33f445c897SJohn MarinoCXX_SUFFIXES?= .cc .cpp .cxx .C 34f445c897SJohn Marino 355f1e34d9SAlexandre Perrin.if !empty(WARNINGS_SET) || !empty(WARNINGS_SET_${MACHINE_ARCH}) 365f1e34d9SAlexandre Perrin.include <warnings.mk> 375f1e34d9SAlexandre Perrin.endif 385f1e34d9SAlexandre Perrin 39ca58f742SDaniel Fojt# these are applied in order, least specific to most 40ca58f742SDaniel FojtVAR_QUALIFIER_LIST += \ 41ca58f742SDaniel Fojt ${TARGET_SPEC_VARS:UMACHINE:@v@${$v}@} \ 42ca58f742SDaniel Fojt ${COMPILER_TYPE} \ 43ca58f742SDaniel Fojt ${.TARGET:T:R} \ 44ca58f742SDaniel Fojt ${.TARGET:T} \ 45ca58f742SDaniel Fojt ${.IMPSRC:T} \ 46ca58f742SDaniel Fojt ${VAR_QUALIFIER_XTRA_LIST} 47ca58f742SDaniel Fojt 48ca58f742SDaniel FojtQUALIFIED_VAR_LIST += \ 49ca58f742SDaniel Fojt CFLAGS \ 50ca58f742SDaniel Fojt COPTS \ 51ca58f742SDaniel Fojt CPPFLAGS \ 52ca58f742SDaniel Fojt CPUFLAGS \ 53ca58f742SDaniel Fojt LDFLAGS \ 54ca58f742SDaniel Fojt 55ca58f742SDaniel Fojt# a final :U avoids errors if someone uses := 56ca58f742SDaniel Fojt.for V in ${QUALIFIED_VAR_LIST:O:u:@q@$q $q_LAST@} 57ca58f742SDaniel Fojt.for Q in ${VAR_QUALIFIER_LIST:u} 58ca58f742SDaniel Fojt$V += ${$V.$Q:U} ${$V.$Q.${COMPILER_TYPE}:U} 59ca58f742SDaniel Fojt.endfor 60ca58f742SDaniel Fojt.endfor 615f1e34d9SAlexandre Perrin 625f1e34d9SAlexandre PerrinCC_PG?= -pg 635f1e34d9SAlexandre PerrinCXX_PG?= ${CC_PG} 645f1e34d9SAlexandre PerrinCC_PIC?= -DPIC 655f1e34d9SAlexandre PerrinCXX_PIC?= ${CC_PIC} 665f1e34d9SAlexandre PerrinPROFFLAGS?= -DGPROF -DPROF 675f1e34d9SAlexandre Perrin 68a34d5fb1SAntonio Huete Jimenez.if ${.MAKE.LEVEL:U1} == 0 && ${MK_DIRDEPS_BUILD:Uno} == "yes" 69*6eef5f0cSAntonio Huete Jimenez.if ${RELDIR} == "." 70*6eef5f0cSAntonio Huete Jimenez# top-level targets that are ok at level 0 71a34d5fb1SAntonio Huete JimenezDIRDEPS_BUILD_LEVEL0_TARGETS += clean* destroy* 72a34d5fb1SAntonio Huete JimenezM_ListToSkip?= O:u:S,^,N,:ts: 73a34d5fb1SAntonio Huete Jimenez.if ${.TARGETS:Uall:${DIRDEPS_BUILD_LEVEL0_TARGETS:${M_ListToSkip}}} != "" 745f1e34d9SAlexandre Perrin# this tells lib.mk and prog.mk to not actually build anything 755f1e34d9SAlexandre Perrin_SKIP_BUILD = not building at level 0 765f1e34d9SAlexandre Perrin.endif 77*6eef5f0cSAntonio Huete Jimenez.elif ${.TARGETS:U:Nall} == "" 78*6eef5f0cSAntonio Huete Jimenez_SKIP_BUILD = not building at level 0 79*6eef5f0cSAntonio Huete Jimenez.endif 80a34d5fb1SAntonio Huete Jimenez.endif 815f1e34d9SAlexandre Perrin 82ca58f742SDaniel Fojt.if !defined(.PARSEDIR) 83ca58f742SDaniel Fojt# no-op is the best we can do if not bmake. 84ca58f742SDaniel Fojt.WAIT: 85ca58f742SDaniel Fojt.endif 86ca58f742SDaniel Fojt 87ca58f742SDaniel Fojt# define this once for consistency 88a34d5fb1SAntonio Huete Jimenez.if !defined(_SKIP_BUILD) 89ca58f742SDaniel Fojt# beforebuild is a hook for things that must be done early 90ca58f742SDaniel Fojtall: beforebuild .WAIT realbuild 91ca58f742SDaniel Fojt.else 92f445c897SJohn Marinoall: .PHONY 93a34d5fb1SAntonio Huete Jimenez.if !empty(_SKIP_BUILD) && ${.MAKEFLAGS:M-V} == "" 94f445c897SJohn Marino.warning ${_SKIP_BUILD} 95f445c897SJohn Marino.endif 96a34d5fb1SAntonio Huete Jimenez.endif 97ca58f742SDaniel Fojtbeforebuild: 98ca58f742SDaniel Fojtrealbuild: 99ca58f742SDaniel Fojt 1005f1e34d9SAlexandre Perrin.endif 101