ymake.core.conf 240 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899
  1. # !!! DISCLAIMER! PLEASE DON'T IGNORE !!!
  2. # The FAKEID value is huge hammer. It affects UIDs of all nodes in build graph including, but not limited to
  3. # any resource fetch (think java contrib), build on any language (C++, Python, Java, Go), any code generation.
  4. # Any build after this change will pay the price:
  5. # - Local builds and Sandbox builds will reload all resources from Sandbox and cached data from YT (if ready).
  6. # - Distributed (YT) cache warmup will take significant time to catch up and will need to recache everything.
  7. # - Autocheck will rebuild and recache everything.
  8. # Use this with extreme care and only change if it is ultimately needed. Consider more specific XXX_FAKEIDs below instead.
  9. FAKEID=328319516716
  10. SANDBOX_FAKEID=${FAKEID}.7600000
  11. CPP_FAKEID=2024-01-23
  12. GO_FAKEID=11100371
  13. ANDROID_FAKEID=2023-05-17
  14. CLANG_TIDY_FAKEID=2023-06-06
  15. CYTHON_FAKE_ID=10784829
  16. JAVA_FAKEID=14386852
  17. PROTO_FAKEID=0
  18. FBS_FAKEID=2024-03-13
  19. # Change of this value will invalidate some parts of configure cache
  20. # but will not affect builds anyhow (except tests referring build/ directory)
  21. JSON_CACHE_FAKE_ID=20241225
  22. STRUCT_CMD=yes
  23. _DBG_EXPR_ERROR_DETAILS=one
  24. CURDIR=.
  25. MODDIR=.
  26. BINDIR=bin:/
  27. SRCDIR=
  28. YMAKE=ymake
  29. ECHO=echo
  30. INCLUDE_EXTS=.h .hh .hpp .rli .cuh .inc .i .ipp .ixx .ya_exposed .hxx .H
  31. CPP_EXT=.cpp
  32. OBJ_SUF=
  33. CFLAGS=
  34. EXTRA_C_FLAGS=
  35. SFLAGS=
  36. SRCFLAGS=
  37. FORCE_COVERAGE_ENABLED=
  38. FORCE_COVERAGE_DISABLED=
  39. LDFLAGS=
  40. LDFLAGS_GLOBAL=
  41. OBJADDE=
  42. OBJADDE_LIB=
  43. OBJADDE_LIB_GLOBAL=
  44. TRUE=yes
  45. FALSE=no
  46. MODULE_PREFIX=
  47. MODULE_SUFFIX=
  48. __COMMA__=${comma:""}
  49. __BSDQ__=\"
  50. when ($STRUCT_CMD == "yes") {
  51. __BSDQ__=\\\"
  52. }
  53. # do not keep it undefined, since we directly subsitute it in LLVM_COMPILE_CXX etc.
  54. WINDOWS=no
  55. # tag:src-processing tag:internal
  56. ### @usage: _SRC(Ext Src Flags) # internal
  57. ###
  58. ### Basic building block of extension-based command dispatching
  59. ### To enable specific extension processing define _SRC() macro with fixed first argument (Ext).
  60. ### Internal logic will apply this macro to all files with this Ext listed in SRC/SRCS macros or outputs
  61. ### of other commands (except ones marked as noauto)
  62. macro _SRC(EXT, SRC, SRCFLAGS...) {
  63. # Generic macro definition for _SRC (just a placeholder, it does nothing)
  64. }
  65. CLANG_VER=14
  66. when ($CLANG16 == "yes") {
  67. CLANG_VER=16
  68. }
  69. when ($CLANG18 == "yes") {
  70. CLANG_VER=18
  71. }
  72. USE_ARCADIA_COMPILER_RUNTIME=yes
  73. when ($LOCAL && $XCODE) {
  74. USE_ARCADIA_COMPILER_RUNTIME=no
  75. }
  76. @import "${CONF_ROOT}/conf/settings.conf"
  77. @import "${CONF_ROOT}/conf/opensource.conf"
  78. @import "${CONF_ROOT}/conf/opensource_export.conf"
  79. @import "${CONF_ROOT}/conf/sysincl.conf"
  80. @import "${CONF_ROOT}/conf/license.conf"
  81. @import "${CONF_ROOT}/conf/docs.conf"
  82. @import "${CONF_ROOT}/conf/swig.conf"
  83. @import "${CONF_ROOT}/conf/proto.conf"
  84. @import "${CONF_ROOT}/conf/fbs.conf"
  85. @import "${CONF_ROOT}/conf/ts/ts.conf"
  86. @import "${CONF_ROOT}/conf/project_specific/other.conf"
  87. @import "${CONF_ROOT}/conf/project_specific/yt.conf"
  88. SO_OUTPUTS=no
  89. when ($USE_PYTHON) {
  90. C_DEFINES+= -DUSE_PYTHON
  91. }
  92. _PREBUILT_TOOLS_ROOT=build/prebuilt
  93. _TOOL_PROTOC_GEN_GO=vendor/github.com/golang/protobuf/protoc-gen-go
  94. _TOOL_PROTOC_GEN_GO_V2=vendor/google.golang.org/protobuf/cmd/protoc-gen-go
  95. _TOOL_PROTOC_GEN_GO_GRPC_V2=vendor/google.golang.org/grpc/cmd/protoc-gen-go-grpc
  96. _TOOL_RESCOMPILER=tools/rescompiler
  97. _TOOL_RESCOMPRESSOR=tools/rescompressor
  98. _TOOL_RORESCOMPILER=tools/rorescompiler
  99. TOOL_CPPYNDEXER=
  100. when ($DISABLE_SEPARATE_AUX_CPP != "yes") {
  101. SEPARATE_AUX_CPP=yes
  102. }
  103. _HOST_SUPPORTS_PREBUILT_PROTOC_GEN_GO=no
  104. _TARGET_SUPPORTS_PREBUILT_PROTOC_GEN_GO=no
  105. when ($USE_PREBUILT_TOOLS == "yes") {
  106. when ($HOST_ARCH_X86_64 == "yes" && ($HOST_OS_LINUX == "yes" || $HOST_OS_WINDOWS == "yes" || $HOST_OS_DARWIN == "yes")) {
  107. _HOST_SUPPORTS_PREBUILT_PROTOC_GEN_GO=yes
  108. }
  109. when ($HOST_ARCH_ARM64 == "yes" && $HOST_OS_DARWIN == "yes") {
  110. _HOST_SUPPORTS_PREBUILT_PROTOC_GEN_GO=yes
  111. }
  112. when ($ARCH_X86_64 == "yes" && ($OS_LINUX == "yes" || $OS_WINDOWS == "yes" || $OS_DARWIN == "yes")) {
  113. _TARGET_SUPPORTS_PREBUILT_PROTOC_GEN_GO=yes
  114. }
  115. when ($ARCH_ARM64 == "yes" && $OS_DARWIN == "yes") {
  116. _TARGET_SUPPORTS_PREBUILT_PROTOC_GEN_GO=yes
  117. }
  118. when ($_HOST_SUPPORTS_PREBUILT_PROTOC_GEN_GO == "yes" && $_TARGET_SUPPORTS_PREBUILT_PROTOC_GEN_GO == "yes") {
  119. _TOOL_PROTOC_GEN_GO=${_PREBUILT_TOOLS_ROOT}/vendor/github.com/golang/protobuf/protoc-gen-go
  120. }
  121. }
  122. CPP_LINTERS_DEFAULT_CONFIGS=build/config/tests/cpp_style/default_configs.json
  123. ### @usage: FUNCTION_ORDERING_FILE(VAR_NAME)
  124. ###
  125. ### Select file for function reordering. Works only with lld linker.
  126. ### VAR_NAME should be the same value that was passed into DECLARE_EXTERNAL_HOST_RESOURCES_BUNDLE library.
  127. macro FUNCTION_ORDERING_FILE(ORDERING_FILE) {
  128. select ($_LINKER_ID) {
  129. "lld" ? {
  130. }
  131. default ? {
  132. _OK = no
  133. }
  134. }
  135. ASSERT(_OK FUNCTION_ORDERING_FILE macro can be used only with `lld` linker, but you chose `$_LINKER_ID`.)
  136. LDFLAGS("-Wl,--symbol-ordering-file=${suf=_RESOURCE_GLOBAL/funcs.ord;pre=$:ORDERING_FILE}")
  137. }
  138. ### @usage: SELECT_CLANG_SA_CONFIG(static_analyzer.yaml)
  139. ###
  140. ### Select config file for clang static analyzer.
  141. ### The file should be called static_analyzer.yaml.
  142. macro SELECT_CLANG_SA_CONFIG(config) {
  143. SET(_CLANG_SA_CONFIG ${input:config})
  144. }
  145. ### @usage: USE_SA_PLUGINS(FROM path/to/external/module1 NAME VAR_NAME1 FROM path/to/external/module2 NAME VAR_NAME2 ...)
  146. ###
  147. ### Select additional plugins for clang static analyzer, each path/to/external/module should declare target RESOURCES_LIBRARY.
  148. ### VAR_NAME should be the same value that was passed into DECLARE_EXTERNAL_HOST_RESOURCES_BUNDLE as first argument.
  149. ### See example in market/report/csa_checks/static_analyzer_ymake.inc
  150. macro USE_SA_PLUGINS(FROM[], NAME[]) {
  151. PEERDIR($FROM)
  152. SET_APPEND(CLANG_SA_PLUGINS ${suf=_RESOURCE_GLOBAL/plugin.so;pre=$:NAME})
  153. }
  154. # Helper macro for unwrapping sequence of files
  155. macro _CLANG_SA_UNWRAP_PLUGINS(Plugins{input}[]) {
  156. .CMD=${Plugins}
  157. }
  158. CLANG_SA_PLUGINS=
  159. CLANG_CSA_ROOT=${CLANG_CSA16_RESOURCE_GLOBAL}
  160. CLANG_CSA_BIN=${CLANG_CSA16_RESOURCE_GLOBAL}/bin/clang
  161. when ($CLANG_SA_ENABLE == "yes" && $_CLANG_SA_CONFIG && $CLANG_CSA_ROOT) {
  162. PEERDIR+=build/platform/clang/clang-static-analyzer
  163. CLANG_STATIC_ANALYZER_OPTIONS_NEW=$YMAKE_PYTHON3 ${input:"build/scripts/clang_static_analyzer.py"} \
  164. "--testing-src" ${input:SRC} \
  165. "--clang-bin" $CLANG_CSA_BIN \
  166. "--source-root" $(SOURCE_ROOT) \
  167. "--config-file" ${input:_CLANG_SA_CONFIG} \
  168. "--plugins-begin" "dummy_param" $CLANG_SA_PLUGINS "--plugins-end" \
  169. $GCC_COMPILE_FLAGS $CXXFLAGS $SRCFLAGS
  170. }
  171. otherwise {
  172. CLANG_STATIC_ANALYZER_OPTIONS_NEW=
  173. }
  174. FAIL_MODULE_CMD=$YMAKE_PYTHON3 ${input:"build/scripts/fail_module_cmd.py"} $TARGET ${hide;kv:"p ER"} ${hide;kv:"pc red"}
  175. FAIL_EXPR=ERROR
  176. DEFAULT_TIDY_CONFIG=build/config/tests/clang_tidy/config.yaml
  177. PROJECT_TIDY_CONFIG=build/config/tests/clang_tidy/config.yaml
  178. TIDY=
  179. TIDY_ENABLED=
  180. when($TIDY == "yes") {
  181. TIDY_ENABLED=yes
  182. }
  183. CLANG_TIDY_BIN=${CLANG_TIDY_RESOURCE_GLOBAL}/bin/clang-tidy
  184. when ($TIDY_ENABLED == "yes") {
  185. when ($TIDY_EXPORT_FIXES=="") {
  186. TIDY_EXPORT_FIXES="no"
  187. }
  188. CLANG_TIDY_ARGS=${hide:CLANG_TIDY_FAKEID} $YMAKE_PYTHON ${input:"build/scripts/clang_tidy.py"} "--ymake-python" $YMAKE_PYTHON "--clang-tidy-bin" $CLANG_TIDY_BIN "--config-validation-script" ${input:"build/tests/config/clang_tidy/tidy_config_validation.py"} "--testing-src" ${input:SRC} "--source-root" $(SOURCE_ROOT) "--build-root" $(BUILD_ROOT) "--tidy-json" ${noauto;output;suf=${COMPILE_OUT_SUFFIX}${OBJ_CROSS_SUF}.tidyjson:SRC} "--export-fixes" $TIDY_EXPORT_FIXES
  189. CLANG_TIDY_ARGS+="--default-config-file" ${input:DEFAULT_TIDY_CONFIG}
  190. CLANG_TIDY_ARGS+="--project-config-file" ${input:PROJECT_TIDY_CONFIG}
  191. when ($TIDY_CHECKS) {
  192. CLANG_TIDY_ARGS+="--checks=$TIDY_CHECKS"
  193. }
  194. when ($TIDY_HEADER_FILTER) {
  195. CLANG_TIDY_ARGS+="--header-filter=$TIDY_HEADER_FILTER"
  196. }
  197. TIDY_VALUE=USE_CONDITIONAL_SRCS
  198. }
  199. otherwise {
  200. CLANG_TIDY_ARGS=
  201. TIDY_VALUE=
  202. }
  203. # tag:profile
  204. NEED_PROFILE_RUNTIME=no
  205. when ($BUILD_TYPE == "PROFILE" || $BUILD_TYPE == "COVERAGE" || ($CLANG_COVERAGE && $CLANG_COVERAGE != "no") || $GCOV_COVERAGE == "yes" || $PGO_ADD == "yes") {
  206. when($CLANG && ($TARGET_PLATFORM == "LINUX" || $TARGET_PLATFORM == "DARWIN")) {
  207. NEED_PROFILE_RUNTIME=yes
  208. }
  209. }
  210. otherwise {
  211. NEED_PROFILE_RUNTIME=no
  212. }
  213. when ($NEED_PROFILE_RUNTIME == "yes") {
  214. COPY_PROFILE_RUNTIME=\
  215. $YMAKE_PYTHON3 ${input:"build/scripts/copy_clang_profile_rt.py"} \
  216. --arch $TARGET_PLATFORM \
  217. --build-root $ARCADIA_BUILD_ROOT --
  218. COPY_PROFILE_RUNTIME+=\
  219. ${rootrel:PEERS} \
  220. $LDFLAGS
  221. }
  222. otherwise {
  223. COPY_PROFILE_RUNTIME=
  224. }
  225. # tag:codenav
  226. when ($CODENAVIGATION && $NOCODENAVIGATION != "yes") {
  227. when ($TOOL_CPPYNDEXER == "") {
  228. _TOOL_CPPYNDEXER_REAL=$CPPYNDEXER_RESOURCE_GLOBAL/yndexer
  229. }
  230. otherwise {
  231. _TOOL_CPPYNDEXER_REAL=$TOOL_CPPYNDEXER
  232. }
  233. PY_PROGRAM_LINK_EXE=$LINK_EXE && ${hide;kv:"pyndex $TARGET"}
  234. YNDEXER_ARGS=$YMAKE_PYTHON ${input:"build/scripts/yndexer.py"} $_TOOL_CPPYNDEXER_REAL 1500 $(SOURCE_ROOT) $ARCADIA_BUILD_ROOT ${input:SRC}
  235. YNDEXER_OUTPUT=${noauto;output;suf=${OBJ_CROSS_SUF}${COMPILE_OUT_SUFFIX}.ydx.pb2:SRC}
  236. }
  237. otherwise {
  238. PY_PROGRAM_LINK_EXE=$LINK_EXE
  239. YNDEXER_ARGS=
  240. YNDEXER_OUTPUT=
  241. }
  242. when ($RETRY == "yes") {
  243. RETRY_ARGS=$YMAKE_PYTHON ${input:"build/scripts/retry_cc.py"}
  244. }
  245. otherwise {
  246. RETRY_ARGS=
  247. }
  248. COVERAGE_FLAGS=
  249. EXTRA_OUTPUT=
  250. when ($CLANG == "yes" || $GCC == "yes") {
  251. when ($BUILD_TYPE == "COVERAGE" || $GCOV_COVERAGE) {
  252. COVERAGE_FLAGS=-fprofile-arcs -ftest-coverage
  253. EXTRA_OUTPUT=${hide;noauto;output;suf=${COMPILE_OUT_SUFFIX}${OBJ_SUF}${_CROSS_SUFFIX}.gcno:SRC}
  254. }
  255. }
  256. when ($OS_CYGWIN == "yes") {
  257. CFLAGS+=-D_LDBL_EQ_DBL=1 -U__STRICT_ANSI__
  258. USE_ASMLIB=no
  259. FSTACK=
  260. }
  261. when ($OS_IOS == "yes" || $OS_ANDROID == "yes") {
  262. USE_ASMLIB=no
  263. }
  264. CFLAGS+=$COVERAGE_FLAGS
  265. LDFLAGS+=$COVERAGE_FLAGS
  266. CHECKFLAG=
  267. NO_MAPREDUCE=
  268. when ($NO_MAPREDUCE == "yes") {
  269. C_DEFINES+=-DNO_MAPREDUCE
  270. }
  271. when ($OS_ANDROID == "yes") {
  272. PIE=yes
  273. }
  274. when ($CLANG && $OS_DARWIN && $SANITIZER_TYPE && $SANITIZER_TYPE != "no") {
  275. SO_OUTPUTS=yes
  276. }
  277. when ($OS_NONE == "yes" || $MAPSMOBI_BUILD_TARGET == "yes" && $OS_LINUX != "yes") {
  278. USE_STL_SYSTEM=yes
  279. }
  280. # USE_INTERNAL_STL is an internal flag (set on by default) but may be used externally to
  281. # select system standard C++ library when USE_INTERNAL_STL=no is set.
  282. #
  283. # USE_STL_SYSTEM=yes is a regular way to select system standard C++ library.
  284. #
  285. when ($USE_STL_SYSTEM == "yes") {
  286. USE_INTERNAL_STL=no
  287. }
  288. when ($USE_INTERNAL_STL == "no") {
  289. USE_STL_SYSTEM=yes
  290. }
  291. otherwise {
  292. USE_INTERNAL_STL=yes
  293. # TODO: Extract to conf/sysincl.conf
  294. # This trigger doesn't work for module level since SYSINCL is processed at
  295. # configuration stage (This means that NO_RUNTIME() macro called in ya.make
  296. # won't affect SYSINCL and the only way to make this trigger work correctly
  297. # is to define configuration variable NORUNTIME (-DNORUNTIME) on the command
  298. # line when `ya make ...` is invoked.
  299. when ($NORUNTIME != "yes") {
  300. SYSINCL+=build/sysincl/stl-to-libcxx.yml
  301. when ($MSVC == "yes" && $CLANG_CL != "yes") {
  302. SYSINCL+=build/sysincl/stl-to-libcxxmsvc.yml
  303. }
  304. when ($NVCC_STD_VER == "17" || $CUDA11 == "yes") {
  305. SYSINCL+=build/sysincl/stl-to-libcxxcuda11.yml
  306. }
  307. when ($MUSL == "yes") {
  308. SYSINCL+=build/sysincl/libc-musl-libcxx.yml
  309. }
  310. }
  311. }
  312. USE_ARCADIA_PYTHON=yes
  313. USE_ARCADIA_LIBM=no
  314. USE_EAT_MY_DATA=no
  315. HAVE_MKL=
  316. when ($HAVE_MKL == "") {
  317. when ($OS_LINUX && $ARCH_X86_64 && !$SANITIZER_TYPE) {
  318. HAVE_MKL=yes
  319. }
  320. otherwise {
  321. HAVE_MKL=no
  322. }
  323. }
  324. SFDL_TMP_OUT= ${output;suf=.tmp:SRC}
  325. # tag:tool-specific
  326. ARCH_TOOL=${tool:"tools/archiver"}
  327. # tag:tool-specific
  328. LUA_TOOL=${tool:"tools/lua"}
  329. ENUM_PARSER_TOOL=${tool:"tools/enum_parser/enum_parser"}
  330. FATAL_ERROR_MODULE=no
  331. FATAL_ERROR_MESSAGE=
  332. ANTLR_PYTHON=Python2
  333. ### @usage: NO_LTO()
  334. ###
  335. ### Disable any lto (link-time optimizations) for the module.
  336. ### This will compile module source files as usual (without LTO) but will not prevent lto-enabled
  337. ### linking of entire program if global settings say so.
  338. macro NO_LTO() {
  339. DISABLE(USE_LTO)
  340. DISABLE(USE_THINLTO)
  341. }
  342. # tag:allocator
  343. DEFAULT_ALLOCATOR=LF
  344. # tag:allocator
  345. when ($OS_ANDROID == "yes" || $MSVC == "yes" || $ARCH_TYPE_32 == "yes" || $ARCH_AARCH64 == "yes") {
  346. DEFAULT_ALLOCATOR=J
  347. }
  348. # tag:allocator
  349. when ($OS_CYGWIN == "yes" || $ARCH_PPC64LE == "yes") {
  350. DEFAULT_ALLOCATOR=SYSTEM
  351. }
  352. # tag:allocator
  353. when ($OS_DARWIN == "yes") {
  354. DEFAULT_ALLOCATOR=SYSTEM
  355. }
  356. # tag:allocator
  357. when ($OS_LINUX == "yes") {
  358. when ($GCC) {
  359. # tcmalloc broken build
  360. }
  361. elsewhen ($ARCH_X86_64) {
  362. DEFAULT_ALLOCATOR=TCMALLOC_TC
  363. }
  364. }
  365. # tag:allocator
  366. when ($SANITIZER_TYPE) {
  367. when ($SANITIZER_TYPE != "no") {
  368. DEFAULT_ALLOCATOR=SYSTEM
  369. }
  370. }
  371. # tag:allocator
  372. when ($ARCH_XTENSA == "yes") {
  373. DEFAULT_ALLOCATOR=FAKE
  374. }
  375. when ($OS_EMSCRIPTEN == "yes") {
  376. DEFAULT_ALLOCATOR=FAKE
  377. }
  378. # tag:internal
  379. ### @usage: CHECK_CONFIG_H(<conf_header>) # internal
  380. ###
  381. ### This internal macro adds checking code for configuration header in external (contrib) library.
  382. ### The check is needed to avoid conflicts on certain types and functions available in arcadia.
  383. ###
  384. ### @see https://a.yandex-team.ru/arc/trunk/arcadia/build/scripts/check_config_h.py for exact details
  385. macro CHECK_CONFIG_H(Conf) {
  386. .CMD=$YMAKE_PYTHON ${input:"build/scripts/check_config_h.py"} ${input;rootrel:Conf} ${output;nopath;noext:Conf.config.cpp} ${hide;kv:"p CH"} ${hide;kv:"pc yellow"}
  387. .SEM=${hide;input;rootrel:Conf} ${hide;output;nopath;noext:Conf.config.cpp}
  388. OUTPUT_INCLUDES=$Conf
  389. }
  390. REQUIRED_TRANSITIVE_PEERS=
  391. ### @usage: REQUIRES(dirs...)
  392. ###
  393. ### Specify list of dirs which this module must depend on indirectly.
  394. ###
  395. ### This macro can be used if module depends on the directories specified but they can't be listed
  396. ### as direct PEERDIR dependencies (due to public include order or link order issues).
  397. macro REQUIRES(DIRS[]) {
  398. SET_APPEND(REQUIRED_TRANSITIVE_PEERS $DIRS)
  399. }
  400. CHECK_DEPENDENT_DIRS_TYPES=
  401. CHECK_DEPENDENT_DIRS_RESTRICTIONS=
  402. ### @usage: CHECK_DEPENDENT_DIRS(DENY|ALLOW_ONLY ([ALL|PEERDIRS|GLOB] dir)...)
  403. ###
  404. ### Specify project transitive dependencies constraints.
  405. ###
  406. ### @params:
  407. ### 1. DENY: current module can not depend on module from any specified directory neither directly nor transitively.
  408. ### 2. ALLOW_ONLY: current module can not depend on module from a dir not specified in the directory list neither directly nor transitively.
  409. ### 3. ALL: directory constraints following after this modifier are applied to both transitive PEERDIR dependencies and tool dependencies.
  410. ### 4. PEERDIRS: directory constraints following after this modifier are applied to transitive PEERDIR dependencies only.
  411. ### 5. GLOB: next directory constraint is an ANT glob pattern.
  412. ### 6. EXCEPT: next constraint is an exception for the rest of other rules.
  413. ###
  414. ### Directory constraints added before either ALL or PEERDIRS modifier is used are treated as ALL directory constraints.
  415. ###
  416. ### Note: Can be used multiple times on the same module all specified constraints will be checked.
  417. ### All macro invocation for the same module must use same constraints type (DENY or ALLOW_ONLY)
  418. macro CHECK_DEPENDENT_DIRS(TYPE, ALL?"UNUSED":"", PEERDIRS?"PEERDIRS":"ALL", RESTRICTIONS...) {
  419. SET_APPEND(CHECK_DEPENDENT_DIRS_RESTRICTIONS $PEERDIRS $RESTRICTIONS)
  420. SET_APPEND(CHECK_DEPENDENT_DIRS_TYPES $TYPE)
  421. }
  422. macro _RESOURCE_SEM(INPUTS[], KEYS[], OPTS[]) {
  423. SET(RESOURCE_OUTPUT ${hash:INPUTS}.cpp)
  424. .SEM=target_macroses-ITEM && target_macroses-macro resources && target_macroses-args ${output;global:RESOURCE_OUTPUT} INPUTS ${input:INPUTS} KEYS $KEYS OPTS $OPTS ${hide;tool:"tools/rescompiler/bin"}
  425. }
  426. # tag:built-in
  427. ### @usage: RESOURCE([FORCE_TEXT ][Src Key]* [- Key=Value]*) # builtin
  428. ### Add data (resources, random files, strings) to the program)
  429. ### The common usage is to place Src file into binary. The Key is used to access it using library/cpp/resource or library/python/resource.
  430. ### Alternative syntax with '- Key=Value' allows placing Value string as resource data into binary and make it accessible by Key.
  431. ###
  432. ### This is a simpler but less flexible option than ARCHIVE(), because in the case of ARCHIVE(), you have to use the data explicitly,
  433. ### and in the case of RESOURCE(), the data will fall through SRCS() or SRCS(GLOBAL) to binary linking.
  434. ###
  435. ### Use the FORCE_TEXT parameter to explicitly mark all Src files as text files: they will not be parsed unless used elsewhere.
  436. ###
  437. ### @example: https://wiki.yandex-team.ru/yatool/howtowriteyamakefiles/#a2ispolzujjtekomanduresource
  438. ###
  439. ### @example:
  440. ###
  441. ### LIBRARY()
  442. ### OWNER(user1)
  443. ###
  444. ### RESOURCE(
  445. ### path/to/file1 /key/in/program/1
  446. ### path/to/file2 /key2
  447. ### )
  448. ### END()
  449. ###
  450. macro RESOURCE(Args...) {
  451. PEERDIR(library/cpp/resource)
  452. }
  453. # tag:sanitize
  454. RUN_NO_SANITIZE=$YMAKE_PYTHON ${input:"build/scripts/run_tool.py"} --
  455. # tag:sanitize
  456. when ($IS_CROSS_SANITIZE) {
  457. RUN_NO_SANITIZE=
  458. }
  459. YIELD=$YMAKE_PYTHON ${input:"build/scripts/yield_line.py"} -- ${BINDIR}/__args
  460. XARGS=$YMAKE_PYTHON ${input:"build/scripts/xargs.py"} -- ${BINDIR}/__args
  461. WRITER_PY=$YMAKE_PYTHON ${input:"build/scripts/writer.py"} ${hide;input:"build/scripts/process_command_files.py"}
  462. FS_TOOLS=$YMAKE_PYTHON3 ${input:"build/scripts/fs_tools.py"} ${hide;input:"build/scripts/process_command_files.py"}
  463. FIX_MSVC_OUTPUT=${YMAKE_PYTHON} ${input:"build/scripts/fix_msvc_output.py"} ${hide;input:"build/scripts/process_command_files.py"}
  464. _PROCESS_WHOLE_ARCHIVE_SCRIPT=${hide;input:"build/scripts/process_command_files.py"} ${hide;input:"build/scripts/process_whole_archive_option.py"}
  465. COPY_CMD=$FS_TOOLS copy
  466. LINK_OR_COPY_CMD=$FS_TOOLS link_or_copy
  467. REMOVE_FILE=$FS_TOOLS remove
  468. MOVE_FILE=$FS_TOOLS rename
  469. # tag:allocator tag:windows-specific
  470. MSVC_DYNAMICBASE=/DYNAMICBASE
  471. when ($ALLOCATOR == "LF") {
  472. MSVC_DYNAMICBASE=/DYNAMICBASE:NO
  473. }
  474. # tag:sanitize
  475. SANITIZER_CFLAGS=
  476. # variables must be defined for all module types to make generate_mf.py work
  477. NEED_PLATFORM_PEERDIRS=yes
  478. PEERDIR_TEST_TOOL=yes
  479. ### @usage: _BARE_UNIT # internal
  480. ###
  481. ### The base of all modules describing default bare minimum for all modules.
  482. ### To avoid surprises, all buildable modules are better to be inherited from it or its descendants.
  483. module _BARE_UNIT {
  484. .EXTS=.*
  485. .CMD=TOUCH_UNIT
  486. .IGNORED=GO_PROTO_PLUGIN
  487. .NODE_TYPE=Bundle
  488. .PEERDIR_POLICY=as_include
  489. .RESTRICTED=GRPC USE_SKIFF INDUCED_DEPS FUZZ_DICTS FUZZ_OPTS PACK EXPLICIT_OUTPUTS DOCS_DIR DOCS_CONFIG DOCS_VARS YT_SPEC USE_CXX USE_UTIL WHOLE_ARCHIVE PRIMARY_OUTPUT SECONDARY_OUTPUT DEPENDENCY_MANAGEMENT EXCLUDE NO_DOCTESTS EMBED_JAVA_VCS_INFO RESOURCE_FILES PACK_GLOBALS_IN_LIBRARY _EXPOSE GLOBAL_DEPS LIST_PROTO
  490. .FINAL_TARGET=no
  491. PEERDIR_TAGS=__EMPTY__ RESOURCE_LIB
  492. PEERDIR+=$YMAKE_PYTHON3_PEERDIR
  493. when ($FATAL_ERROR_MESSAGE && $FATAL_ERROR_MODULE != "yes") {
  494. PEERDIR+=build/conf_fatal_error
  495. }
  496. DEFAULT(MODULE_VERSION)
  497. DEFAULT(MODULE_PREFIX)
  498. DEFAULT(MODULE_SUFFIX)
  499. }
  500. ### @usage: GEN_LIBRARY()
  501. ###
  502. ### Definition of a module that brings generated artefacts. This module can PEERDIRed
  503. ### from any module. The resulted module is empty and cleaned up during construction
  504. ### of the build graph.
  505. ###
  506. ### NOTE! SRCS macro is not supported for this library.
  507. module GEN_LIBRARY: _BARE_UNIT {
  508. .PROXY=yes
  509. .RESTRICTED=SRCS SRC
  510. .SEM=_SEM_IGNORED
  511. # ENABLE(_FAKE_MODULE)
  512. SET(MODULE_TAG RESOURCE_LIB)
  513. SET(MODULE_SUFFIX .pkg.fake)
  514. }
  515. ### @usage: _BASE_UNIT # internal
  516. ###
  517. ### The base of all LIBRARY/PROGRAM modules describing common logic for all modules.
  518. ### To avoid surprises, all buildable modules are better to be inherited from it or its descendants.
  519. module _BASE_UNIT: _BARE_UNIT {
  520. .GLOBAL=_FBS_NAMESPACE_MAP
  521. PEERDIR_TAGS=CPP_PROTO CPP_PROTO_FROM_SCHEMA CPP_FBS CPP_ROS H_IDL PY2 PY2_NATIVE YQL_UDF_STATIC __EMPTY__ RESOURCE_LIB DLL_LIB
  522. _CPP_PROTO_WRAPPER_BASE=$YMAKE_PYTHON3 ${input:"build/scripts/cpp_proto_wrapper.py"}
  523. _CPP_PROTO_CMDLINE_BASE=${cwd;rootdir;input:File} $PROTOC -I=./$PROTO_NAMESPACE -I=$ARCADIA_ROOT/$PROTO_NAMESPACE ${pre=-I=:_PROTO__INCLUDE} -I=$ARCADIA_BUILD_ROOT -I=$PROTOBUF_INCLUDE_PATH --cpp_out=${CPP_PROTO_PLUGINS}$ARCADIA_BUILD_ROOT/$PROTO_NAMESPACE $_PROTOC_FLAGS $PROTOC_STYLEGUIDE_OUT $PROTOC_PLUGIN_STYLEGUIDE ${hide:PROTO_FAKEID} ${input;rootrel:File}
  524. CPP_PROTO_CMDLINE=$_CPP_PROTO_WRAPPER_BASE --outputs $CPP_PROTO_OUTS -- $_CPP_PROTO_CMDLINE_BASE
  525. CPP_PROTO_OUTS+=${output;norel;nopath;noext:File.pb.cc} ${output;main;norel;nopath;noext:File.pb.h}
  526. CPP_PROTO_OUTS_SEM+=${output;main;hide;norel;nopath;noext:File.pb.h}
  527. CPP_EV_CMDLINE=$_CPP_PROTO_WRAPPER_BASE --outputs $CPP_EV_OUTS -- $_CPP_PROTO_CMDLINE_BASE
  528. CPP_EV_OUTS+=${output;norel:File.pb.cc} ${output;norel:File.pb.h}
  529. CPP_EV_OUTS_SEM+=${hide;output;norel:File.pb.h}
  530. when ($SWIG_LANG == "perl") {
  531. _SWIG_CMD=$_SWIG_PERL_CMD
  532. _SWIG_PEERDIR=contrib/tools/swig/Lib/perl5 build/platform/perl
  533. }
  534. elsewhen ($SWIG_LANG == "python") {
  535. _SWIG_CMD=$_SWIG_PYTHON_CMD
  536. _SWIG_PEERDIR=contrib/tools/swig/Lib/python
  537. }
  538. elsewhen ($SWIG_LANG == "jni_cpp") {
  539. _SWIG_CMD=$_SWIG_JNI_CPP_CMD
  540. _SWIG_PEERDIR=contrib/tools/swig/Lib/java $_SWIG_JNI_PEERDIR
  541. }
  542. elsewhen ($SWIG_LANG == "java") {
  543. _SWIG_CMD=$_SWIG_JNI_CMD
  544. _SWIG_PEERDIR=contrib/tools/swig/Lib/java $_SWIG_JNI_PEERDIR
  545. }
  546. when ($PY_PROTOS_FOR == "yes") {
  547. _EVLOG_CMDLINE=$_PY_EVLOG_CMDLINE
  548. _PROTO_CMDLINE=$_PY_PROTO_CMDLINE
  549. }
  550. otherwise {
  551. _EVLOG_CMDLINE=$_CPP_EVLOG_CMDLINE
  552. _FBS_CMDLINE=$_CPP_FLATC_CMDLINE
  553. when ($BUILD_PROTO_AS_EVLOG == "yes") {
  554. _PROTO_CMDLINE=$_CPP_PROTO_EVLOG_CMDLINE
  555. }
  556. otherwise {
  557. _PROTO_CMDLINE=$_CPP_PROTO_CMDLINE
  558. }
  559. when ($USE_VANILLA_PROTOC == "yes") {
  560. PROTOC=${tool:"contrib/tools/protoc_std"}
  561. PROTOC_STYLEGUIDE_OUT=
  562. PROTOC_PLUGIN_STYLEGUIDE=
  563. PROTOBUF_INCLUDE_PATH=${ARCADIA_ROOT}/contrib/libs/protobuf_std/src
  564. _PROTO_CMDLINE=$_CPP_VANILLA_PROTO_CMDLINE
  565. }
  566. when ($PROTOC_TRANSITIVE_HEADERS == "no") {
  567. CPP_PROTO_PLUGINS=proto_h=true:${CPP_PROTO_PLUGINS}
  568. CPP_PROTO_OUTS+=${output;main;norel;nopath;noext:File.deps.pb.h}
  569. CPP_PROTO_OUTS_SEM+=${output;main;hide;norel;nopath;noext:File.deps.pb.h}
  570. PROTOC_EXTRA_OUTS_SEM=&& protoc_extra_outs .deps.pb.h
  571. }
  572. }
  573. SANITIZER_DEFINED=no
  574. when ($SANITIZER_TYPE && $SANITIZER_TYPE != "no") {
  575. CFLAGS+=-fsanitize=$SANITIZER_TYPE -D${SANITIZER_TYPE}_sanitizer_enabled $SANITIZER_CFLAGS -fno-omit-frame-pointer
  576. LDFLAGS+=-fsanitize=$SANITIZER_TYPE
  577. SANITIZER_DEFINED=yes
  578. when ($CLANG) {
  579. CFLAGS+=-fsanitize-blacklist=${input:"build/sanitize-blacklist.txt"} -fno-sanitize-link-runtime
  580. LDFLAGS+=-fsanitize-blacklist=${input:"build/sanitize-blacklist.txt"} -fno-sanitize-link-runtime
  581. }
  582. }
  583. when ($SANITIZER_TYPE && $SANITIZER_TYPE == "memory") {
  584. CFLAGS+=-fno-sanitize-memory-use-after-dtor -Wno-unused-command-line-argument
  585. }
  586. when ($SANITIZE_COVERAGE && $SANITIZE_COVERAGE != "no") {
  587. CFLAGS+=-fsanitize-coverage=$SANITIZE_COVERAGE
  588. LDFLAGS+=-fsanitize-coverage=$SANITIZE_COVERAGE
  589. }
  590. POPULATE_CPP_COVERAGE_FLAGS()
  591. when ($NLG_COVERAGE && $NLG_COVERAGE != "no") {
  592. CFLAGS+=-DNLG_COVERAGE
  593. }
  594. when ($GCC) {
  595. select ($SANITIZER_TYPE) {
  596. "address" ? {
  597. LDFLAGS+=-static-libasan
  598. }
  599. "undefined" ? {
  600. LDFLAGS+=-static-libubsan
  601. }
  602. "thread" ? {
  603. PIE=yes
  604. LDFLAGS+=-static-libtsan
  605. }
  606. }
  607. }
  608. when ($HARDENING == "yes") {
  609. when ($CLANG) {
  610. CFLAGS+=-fstack-protector-all -D_hardening_enabled_
  611. LDFLAGS+=-z relro -z now -z noexecstack
  612. PIE=yes
  613. }
  614. }
  615. when ($USE_LTO == "yes") {
  616. when ($GCC) {
  617. CFLAGS+=-flto -fno-fat-lto-objects
  618. LDFLAGS+=-flto
  619. NO_LTO_CFLAGS=-fno-lto
  620. }
  621. when ($CLANG) {
  622. CFLAGS+=-flto
  623. LDFLAGS+=-flto
  624. NO_LTO_CFLAGS=-fno-lto
  625. }
  626. }
  627. when ($USE_THINLTO == "yes") {
  628. when ($GCC) {
  629. CFLAGS+=-flto=thin
  630. LDFLAGS+=-flto=thin
  631. NO_LTO_CFLAGS=-fno-lto
  632. }
  633. when ($CLANG) {
  634. CFLAGS+=-flto=thin
  635. LDFLAGS+=-flto=thin
  636. NO_LTO_CFLAGS=-fno-lto
  637. }
  638. }
  639. when ($CLANG) {
  640. when ($PGO_ADD == "yes") {
  641. CFLAGS+=-fprofile-instr-generate
  642. LDFLAGS+=-fprofile-instr-generate
  643. }
  644. when ($PGO_PATH) {
  645. CFLAGS+=-fprofile-instr-use=$PGO_PATH -Wno-profile-instr-unprofiled -Wno-profile-instr-out-of-date
  646. LDFLAGS+=-fprofile-instr-use=$PGO_PATH
  647. }
  648. }
  649. when ($COMPILER_PLATFORM && $NEED_PLATFORM_PEERDIRS == "yes") {
  650. PEERDIR+=$COMPILER_PLATFORM
  651. }
  652. when ($OS_LINUX && $NEED_PLATFORM_PEERDIRS == "yes") {
  653. PEERDIR+=contrib/libs/linux-headers
  654. }
  655. when ($NORUNTIME != "yes") {
  656. PEERDIR+=contrib/libs/cxxsupp
  657. when ($MAPSMOBI_BUILD_TARGET == "yes") {
  658. PEERDIR+=build/platform/mapkit
  659. }
  660. }
  661. when ($NOUTIL != "yes") {
  662. PEERDIR+=util
  663. }
  664. when ($MUSL == "yes") {
  665. CFLAGS += -D_musl_
  666. PEERDIR+=contrib/libs/musl/include
  667. }
  668. when ($OS_EMSCRIPTEN == "yes") {
  669. when ($NOLIBC != "yes") {
  670. PEERDIR+=contrib/restricted/emscripten/include
  671. PEERDIR+=contrib/restricted/emscripten/system/lib/c
  672. PEERDIR+=contrib/restricted/emscripten/system/lib/dlmalloc
  673. PEERDIR+=contrib/restricted/emscripten/system/lib/standalonewasm
  674. }
  675. }
  676. # g++ has proxy C-headers which are incompatible with libc++ proxy C-headers.
  677. # The same problem exists for clang toolchain. On the other hand, the problem
  678. # doesn't affect cl since it has united C/C++ library and doesn't need
  679. # proxy C-headers.
  680. # Disable all C++ headers including proxy C-headers when we use libc++.
  681. when ($USE_INTERNAL_STL == "yes" && $MSVC != "yes") {
  682. CXXFLAGS += -nostdinc++
  683. }
  684. otherwise {
  685. CFLAGS += -DUSE_STL_SYSTEM
  686. }
  687. when ($CODENAVIGATION && $NOCODENAVIGATION != "yes") {
  688. PEERDIR += build/external_resources/codenavigation
  689. }
  690. when ($CYTHON_COVERAGE && $CYTHON_COVERAGE == "yes") {
  691. CFLAGS+=-DCYTHON_TRACE=1 -DCYTHON_TRACE_NOGIL=1
  692. }
  693. DEFAULT(USE_SSE4 yes)
  694. when ($NOSSE != "yes") {
  695. CFLAGS+=$SSE_CFLAGS
  696. C_DEFINES+=$SSE_DEFINES
  697. when ($USE_SSE4 == "yes") {
  698. CFLAGS+=$SSE4_CFLAGS
  699. C_DEFINES+=$SSE4_DEFINES
  700. }
  701. }
  702. elsewhen ($MSVC != "yes") {
  703. CFLAGS += -mno-sse
  704. }
  705. POPULATE_CPP_COVERAGE_FLAGS()
  706. _REGISTER_NO_CHECK_IMPORTS()
  707. DEFAULT(PACKAGE_PREFIX_ARGS)
  708. DEFAULT(SWIG_LANG python)
  709. DEFAULT(GP_FLAGS -CtTLANSI-C -Dk* -c)
  710. when ($NEED_LLVM_TOOLS_PEERDIR && $NEED_PLATFORM_PEERDIRS == "yes") {
  711. PEERDIR+=build/platform/clang
  712. LLVM_TOOLS_ROOT=$CLANG18_RESOURCE_GLOBAL
  713. }
  714. when ($TIDY_ENABLED == "yes") {
  715. PEERDIR+=build/platform/clang/clang-tidy
  716. }
  717. ENABLE(USE_YASM_ASSEMBLER)
  718. ENABLE(_BISON_FLEX_SET_DEFAULTS)
  719. }
  720. _LINKER_ID=
  721. # GCC does not support -fuse-ld with an executable path,
  722. # only -fuse-ld=gold or -fuse-ld=lld.
  723. when ($_LINKER_ID != "" && $_DEFAULT_LINKER_ID != "" && $CLANG == "yes" && $NEED_PLATFORM_PEERDIRS == "yes") {
  724. when ($_LINKER_ID in [ "gold", "lld", "mold" ]) {
  725. PEERDIR+=build/platform/${_LINKER_ID}
  726. }
  727. }
  728. macro _USE_LINKER_IMPL(LINKER_ID...) {
  729. SET(_LINKER_ID $LINKER_ID)
  730. }
  731. macro _USE_LINKER() {
  732. _USE_LINKER_IMPL($_DEFAULT_LINKER_ID)
  733. }
  734. ### @usage: USE_LINKER_GOLD()
  735. ### Use gold linker for a program. This doesn't work in libraries
  736. macro USE_LINKER_GOLD() {
  737. _USE_LINKER_IMPL(gold)
  738. }
  739. COMMON_LINK_SETTINGS=
  740. LINK_ADDITIONAL_SECTIONS=
  741. LINK_ADDITIONAL_SECTIONS_COMMAND=
  742. when ($COMMON_LINK_SETTINGS == "yes") {
  743. when ($_LINKER_ID == "lld" && ($OS_LINUX == "yes" || $OS_ANDROID == "yes")) {
  744. LDFLAGS += -Wl,--gdb-index
  745. }
  746. when ($EMBED_LINKER_CREF == "yes") {
  747. LDFLAGS+=-Wl,--cref ${stdout;tmp;pre=$MODULE_PREFIX;suf=.ldcref:REALPRJNAME} -Wl,--no-demangle
  748. LINK_ADDITIONAL_SECTIONS+=--add-section=.ya.linker_cref=${tmp;pre=$MODULE_PREFIX;suf=.ldcref:REALPRJNAME}
  749. }
  750. elsewhen ($DUMP_LINKER_CREF == "yes") {
  751. LDFLAGS+=-Wl,--cref ${stdout;output;pre=$MODULE_PREFIX;suf=.ldcref:REALPRJNAME} -Wl,--no-demangle
  752. }
  753. when ($EMBED_LINKER_MAP == "yes") {
  754. LDFLAGS+=-Wl,-Map=${tmp;pre=$MODULE_PREFIX;suf=.map.$_LINKER_ID:REALPRJNAME}
  755. LINK_ADDITIONAL_SECTIONS+=--add-section=.ya.linker_map.${_LINKER_ID}=${tmp;pre=$MODULE_PREFIX;suf=.map.$_LINKER_ID:REALPRJNAME}
  756. }
  757. elsewhen ($DUMP_LINKER_MAP == "yes") {
  758. LDFLAGS+=-Wl,-Map=${rootrel;output;pre=$MODULE_PREFIX;suf=.map.$_LINKER_ID:REALPRJNAME}
  759. }
  760. when ($USE_MKL == "yes") {
  761. NOPLATFORM=yes
  762. }
  763. when ($AUTOCHECK == "yes" && $OS_LINUX == "yes") {
  764. PEERDIR+=contrib/libs/libeatmydata
  765. # We can not use LICENSE_RESTRICTION_EXCEPTIONS() macro inside a trigger.
  766. # Duplicate its implementation here
  767. MODULE_LICENSES_RESTRICTION_EXCEPTIONS+=contrib/libs/libeatmydata
  768. }
  769. when ($OS_EMSCRIPTEN == "yes") {
  770. # Do nothing.
  771. }
  772. otherwise {
  773. when ($USE_ARCADIA_LIBM == "yes") {
  774. PEERDIR+=contrib/libs/libm
  775. }
  776. when ($USE_ARCADIA_LIBM == "no") {
  777. C_SYSTEM_LIBRARIES+=-lm
  778. }
  779. }
  780. when (($MUSL != "yes" && $WITH_VALGRIND == "yes") || $SANITIZER_DEFINED == "yes") {
  781. when ($ALLOCATOR in [ "TCMALLOC", "TCMALLOC_SMALL_BUT_SLOW", "TCMALLOC_NUMA_256K", "TCMALLOC_NUMA_LARGE_PAGES", "TCMALLOC_256K", "TCMALLOC_TC", "GOOGLE", "J", "LF", "LF_YT", "LF_DBG", "B", "BM", "C", "LOCKLESS", "YT", "YT_TCMALLOC", "YT_TCMALLOC_256K", "MIM", "MIM_SDC", "HU", "PROFILED_HU", "THREAD_PROFILED_HU" ]) {
  782. PEERDIR+=library/cpp/malloc/system
  783. }
  784. }
  785. otherwise {
  786. select ($ALLOCATOR) {
  787. "MIM" ? {
  788. PEERDIR+=library/cpp/malloc/mimalloc
  789. }
  790. "MIM_SDC" ? {
  791. PEERDIR+=library/cpp/malloc/mimalloc_sdc
  792. }
  793. "HU" ? {
  794. PEERDIR+=library/cpp/malloc/hu
  795. }
  796. "PROFILED_HU" ? {
  797. PEERDIR+=library/cpp/malloc/profiled_hu
  798. }
  799. "THREAD_PROFILED_HU" ? {
  800. PEERDIR+=library/cpp/malloc/thread_profiled_hu
  801. }
  802. "TCMALLOC_256K" ? {
  803. PEERDIR+=library/cpp/malloc/tcmalloc
  804. PEERDIR+=contrib/libs/tcmalloc
  805. }
  806. "TCMALLOC_SMALL_BUT_SLOW" ? {
  807. PEERDIR+=library/cpp/malloc/tcmalloc
  808. PEERDIR+=contrib/libs/tcmalloc/small_but_slow
  809. }
  810. "TCMALLOC_NUMA_256K" ? {
  811. PEERDIR+=library/cpp/malloc/tcmalloc
  812. PEERDIR+=contrib/libs/tcmalloc/numa_256k
  813. }
  814. "TCMALLOC_NUMA_LARGE_PAGES" ? {
  815. PEERDIR+=library/cpp/malloc/tcmalloc
  816. PEERDIR+=contrib/libs/tcmalloc/numa_large_pages
  817. }
  818. "TCMALLOC" ? {
  819. PEERDIR+=library/cpp/malloc/tcmalloc
  820. PEERDIR+=contrib/libs/tcmalloc/default
  821. }
  822. "TCMALLOC_TC" ? {
  823. PEERDIR+=library/cpp/malloc/tcmalloc
  824. PEERDIR+=contrib/libs/tcmalloc/no_percpu_cache
  825. }
  826. "GOOGLE" ? {
  827. PEERDIR+=library/cpp/malloc/galloc
  828. }
  829. "J" ? {
  830. when ($WIN32 == "yes") {
  831. PEERDIR+=library/cpp/malloc/system
  832. }
  833. otherwise {
  834. PEERDIR+=library/cpp/malloc/jemalloc
  835. }
  836. }
  837. "LF" ? {
  838. PEERDIR+=library/cpp/lfalloc
  839. }
  840. "LF_YT" ? {
  841. PEERDIR+=library/cpp/lfalloc/yt
  842. }
  843. "LF_DBG" ? {
  844. PEERDIR+=library/cpp/lfalloc/dbg
  845. }
  846. "B" ? {
  847. PEERDIR+=library/cpp/balloc
  848. }
  849. "BM" ? {
  850. PEERDIR+=library/cpp/balloc_market
  851. }
  852. "C" ? {
  853. PEERDIR+=library/cpp/malloc/calloc
  854. }
  855. "LOCKLESS" ? {
  856. PEERDIR+=library/cpp/malloc/lockless
  857. }
  858. "YT" ? {
  859. PEERDIR+=library/cpp/ytalloc/impl
  860. }
  861. "YT_TCMALLOC" ? {
  862. PEERDIR+=library/cpp/malloc/tcmalloc
  863. PEERDIR+=contrib/libs/yt_tcmalloc/default
  864. }
  865. "YT_TCMALLOC_256K" ? {
  866. PEERDIR+=library/cpp/malloc/tcmalloc
  867. PEERDIR+=contrib/libs/yt_tcmalloc
  868. }
  869. }
  870. }
  871. when ($ALLOCATOR == "SYSTEM") {
  872. PEERDIR+=library/cpp/malloc/system
  873. }
  874. when ($ICC == "yes") {
  875. PEERDIR+=contrib/libs/intel/core
  876. }
  877. when ($WITH_VALGRIND == "yes") {
  878. PEERDIR+=contrib/libs/valgrind
  879. # https://st.yandex-team.ru/DTCC-122
  880. CFLAGS+=-fdebug-default-version=4
  881. }
  882. }
  883. when ($EMBED_LINKER_MAP == "yes" || $EMBED_LINKER_CREF == "yes") {
  884. LINK_ADDITIONAL_SECTIONS_COMMAND+= \
  885. $OBJCOPY_TOOL $LINK_ADDITIONAL_SECTIONS $TARGET
  886. }
  887. _SO_EXT_FILTER=${ext=.so:PEERS} ${hide;late_out;ext=.so;pre=$BINDIR/;nopath;tags_cut:PEERS}
  888. when ($OS_WINDOWS == "yes") {
  889. _SO_EXT_FILTER=${ext=.dll:PEERS} ${hide;late_out;ext=.dll;pre=$BINDIR/;nopath;tags_cut:PEERS}
  890. }
  891. elsewhen ($OS_DARWIN == "yes" || $OS_IOS == "yes") {
  892. _SO_EXT_FILTER=${ext=.dylib:PEERS} ${hide;late_out;ext=.dylib;pre=$BINDIR/;nopath;tags_cut:PEERS}
  893. }
  894. LINK_OR_COPY_SO_CMD=
  895. RPATH_GLOBAL=
  896. when ($SO_OUTPUTS == "yes") {
  897. LINK_OR_COPY_SO_CMD=$FS_TOOLS link_or_copy_to_dir --no-check $_SO_EXT_FILTER ${BINDIR}
  898. LDFLAGS+=$RPATH_GLOBAL
  899. }
  900. # tag:restricted tag:DLL
  901. ### @usage: WITH_DYNAMIC_LIBS() # restricted
  902. ###
  903. ### Include dynamic libraries as extra PROGRAM/DLL outputs
  904. macro WITH_DYNAMIC_LIBS() {
  905. ENABLE(SO_OUTPUTS)
  906. }
  907. # tag:internal
  908. ### @usage: REAL_LINK_EXE_IMPL(peers...) # internal
  909. macro REAL_LINK_EXE_IMPL(WHOLE_ARCHIVE_PEERS...) {
  910. .CMD=$REAL_LINK_EXE_CMDLINE && $LINK_OR_COPY_SO_CMD
  911. }
  912. # tag:internal
  913. ### @usage: REAL_LINK_EXEC_DYN_LIB_IMPL(peers...) # internal
  914. macro REAL_LINK_EXEC_DYN_LIB_IMPL(WHOLE_ARCHIVE_PEERS...) {
  915. .CMD=$REAL_LINK_EXEC_DYN_LIB_CMDLINE
  916. }
  917. # tag:internal
  918. ### @usage: REAL_LINK_DYN_LIB_IMPL(peers...) # internal
  919. macro REAL_LINK_DYN_LIB_IMPL(WHOLE_ARCHIVE_PEERS...) {
  920. .CMD=$REAL_LINK_DYN_LIB_CMDLINE && $LINK_OR_COPY_SO_CMD
  921. }
  922. # tag:internal
  923. ### @usage: LINK_EXE_IMPL(peers...) # internal
  924. macro LINK_EXE_IMPL(WHOLE_ARCHIVE_PEERS...) {
  925. .CMD=$LINK_EXE_CMDLINE && $LINK_OR_COPY_SO_CMD
  926. }
  927. # tag:internal
  928. ### @usage: LINK_EXEC_DYN_LIB_IMPL(peers...) # internal
  929. macro LINK_EXEC_DYN_LIB_IMPL(WHOLE_ARCHIVE_PEERS...) {
  930. .CMD=$LINK_EXEC_DYN_LIB_CMDLINE
  931. }
  932. # tag:internal
  933. ### @usage: _LINK_UNIT # internal
  934. ###
  935. ### The base of all linkable modules: programs, DLLs etc. Describes common linking logic.
  936. module _LINK_UNIT: _BASE_UNIT {
  937. .EXTS=.o .obj .supp .sbom .tidyjson .ld .a .lib .pyplugin
  938. .CMD=$LINK_EXE
  939. .STRUCT_CMD=yes
  940. .ALLOWED=EXTRALIBS OBJADDE_GLOBAL RESOURCE_FILES
  941. .NODE_TYPE=Program
  942. .PEERDIR_POLICY=as_build_from
  943. .FINAL_TARGET=yes
  944. .DEFAULT_NAME_GENERATOR=DirName
  945. .ARGS_PARSER=Base
  946. DEFAULT(ALLOCATOR $DEFAULT_ALLOCATOR)
  947. _USE_LINKER()
  948. #link with libunwind manually
  949. when ($DARWIN == "yes" && $NOPLATFORM != "yes") {
  950. PEERDIR += contrib/libs/cxxsupp
  951. }
  952. when ($NEED_PROFILE_RUNTIME == "yes") {
  953. LDFLAGS+=-resource-dir=contrib/libs/clang-rt
  954. PEERDIR+=contrib/libs/clang${CLANG_VER}-rt/lib/profile
  955. }
  956. when ($USE_DYNAMIC_CUDA == "yes") {
  957. LINK_DYN_LIB_FLAGS += --dynamic-cuda
  958. LINK_SCRIPT_EXE_FLAGS += --dynamic-cuda
  959. }
  960. when ($SANITIZER_TYPE && $SANITIZER_TYPE != "no") {
  961. PEERDIR += library/cpp/sanitizer/plugin
  962. }
  963. when ($USE_DYNAMIC_CUDA != "yes") {
  964. when ($CUDA_ARCHITECTURES) {
  965. LINK_DYN_LIB_FLAGS+=--cuda-architectures $CUDA_ARCHITECTURES
  966. LINK_SCRIPT_EXE_FLAGS+=--cuda-architectures $CUDA_ARCHITECTURES
  967. LINK_DYN_LIB_FLAGS+=--nvprune-exe $CUDA_ROOT/bin/nvprune
  968. LINK_SCRIPT_EXE_FLAGS+=--nvprune-exe $CUDA_ROOT/bin/nvprune
  969. }
  970. LINK_DYN_LIB_FLAGS+=--objcopy-exe $OBJCOPY_TOOL
  971. LINK_SCRIPT_EXE_FLAGS+=--objcopy-exe $OBJCOPY_TOOL
  972. }
  973. LINK_SCRIPT_EXE_FLAGS += ${pre=--exclude-libs :_LINK_EXCLUDE_LIBRARIES_GLOBAL}
  974. when ($OPENSOURCE == "yes" && $AUTOCHECK == "yes") {
  975. # FIXME: Replace AUTOCHECK == yes with _not a host platform_ check after YMAKE-218
  976. MODULE_LICENSES_RESTRICTION_TYPES = ALLOW_ONLY
  977. MODULE_LICENSES_RESTRICTIONS = SERVICE REQUIRE_CITATION REQUIRE_MODIFICATIONS_DISCLOSURE
  978. }
  979. when ($OS_IOS == "yes" || $OS_ANDROID == "yes" || $MAPSMOBI_BUILD_TARGET == "yes") {
  980. MODULE_LICENSES_RESTRICTION_TYPES = ALLOW_ONLY
  981. MODULE_LICENSES_RESTRICTIONS = SERVICE REQUIRE_CITATION
  982. }
  983. ENABLE(COMMON_LINK_SETTINGS)
  984. CHECK_PROVIDES()
  985. ADD_CLANG_TIDY()
  986. when ($TIDY_ENABLED == "yes") {
  987. MODULE_PREFIX=
  988. MODULE_SUFFIX=.tidyjson
  989. _MAKEFILE_INCLUDE_LIKE_DEPS+=${ARCADIA_ROOT}/build/yandex_specific/config/clang_tidy/tidy_project_map.json
  990. _MAKEFILE_INCLUDE_LIKE_DEPS+=${ARCADIA_ROOT}/build/yandex_specific/config/clang_tidy/tidy_default_map.json
  991. }
  992. }
  993. MODULE_TYPE=UNKNOWN
  994. macro ADD_CLANG_TIDY() {
  995. ADD_YTEST($MODULE_PREFIX$REALPRJNAME$MODULE_SUFFIX clang_tidy)
  996. }
  997. # tag:internal
  998. ### @usage: _BASE_PROGRAM # internal
  999. ###
  1000. ### The base of all programs. It adds dependencies to make final artefact complete and runnable.
  1001. module _BASE_PROGRAM: _LINK_UNIT {
  1002. .SYMLINK_POLICY=EXE
  1003. .ALLOWED=INDUCED_DEPS WHOLE_ARCHIVE
  1004. .GLOBAL=LDFLAGS _WHOLE_ARCHIVE_LIBS_VALUE RPATH OBJADDE_LIB _LINK_EXCLUDE_LIBRARIES
  1005. SET(MODULE_TYPE PROGRAM)
  1006. .TRANSITION=nopic
  1007. SET(MODULE_LANG CPP)
  1008. FORCE_COVERAGE_ENABLED=yes
  1009. when ($OS_EMSCRIPTEN == "yes") {
  1010. # For WASM platforms at present we just check that code compiles successfully,
  1011. # these entries need to suppress linker errors.
  1012. LDFLAGS += -Wl,--no-entry
  1013. LDFLAGS += -Wl,--import-undefined
  1014. }
  1015. when ($OS_IOS == "yes") {
  1016. EXTS+=.ios.interface
  1017. }
  1018. when ($WIN32 == "yes" || $OS_CYGWIN == "yes") {
  1019. MODULE_SUFFIX=.exe
  1020. }
  1021. when ($MSVC != "yes" && $NOPLATFORM != "yes" && $WITH_VALGRIND != "yes" && $USE_ASMLIB != "no" && $MIC_ARCH != "yes" && $PIC != "yes" && $PIE != "yes") {
  1022. when ($OS_LINUX == "yes" && $ARCH_X86_64 == "yes" && $MUSL != "yes" && $SANITIZER_DEFINED != "yes" && $USE_THINLTO != "yes") {
  1023. PEERDIR+=contrib/libs/glibcasm
  1024. }
  1025. otherwise {
  1026. PEERDIR+=contrib/libs/asmlib
  1027. }
  1028. }
  1029. when ($MUSL == "yes") {
  1030. when ($MUSL_LITE == "yes") {
  1031. PEERDIR += contrib/libs/musl
  1032. }
  1033. otherwise {
  1034. PEERDIR += contrib/libs/musl/full
  1035. }
  1036. }
  1037. DEFAULT(CPU_CHECK yes)
  1038. when ($USE_SSE4 != "yes" || $NOUTIL == "yes" || $ALLOCATOR == "FAKE") {
  1039. CPU_CHECK = no
  1040. }
  1041. when ($CPU_CHECK == "yes") {
  1042. PEERDIR += library/cpp/cpuid_check
  1043. }
  1044. when ($USE_ARC_PROFILE == "yes" && $NOUTIL != "yes") {
  1045. PEERDIR += library/cpp/execprofile/autostart
  1046. }
  1047. when ($SANITIZER_TYPE && $SANITIZER_TYPE != "no") {
  1048. when ($CLANG) {
  1049. select ($TARGET_PLATFORM) {
  1050. "LINUX" ? {
  1051. PEERDIR += library/cpp/sanitizer/${SANITIZER_TYPE}/static
  1052. }
  1053. "DARWIN" ? {
  1054. # Memory sanitizer is not supported for darwin platform.
  1055. # https://clang.llvm.org/docs/MemorySanitizer.html#supported-platforms
  1056. when ($SANITIZER_TYPE != "memory") {
  1057. PEERDIR += library/cpp/sanitizer/${SANITIZER_TYPE}/dynamic
  1058. }
  1059. }
  1060. default ? {
  1061. FATAL_ERROR_MESSAGE+=Unsupported platform for sanitizer
  1062. }
  1063. }
  1064. }
  1065. }
  1066. when ($CLANG_COVERAGE && $CLANG_COVERAGE != "no") {
  1067. PEERDIR+=library/cpp/testing/dump_clang_coverage
  1068. }
  1069. when ($_CUSTOM_LINK_STEP_SCRIPT) {
  1070. LINK_SCRIPT_EXE_FLAGS+=--python=$YMAKE_PYTHON --custom-step=${input:_CUSTOM_LINK_STEP_SCRIPT}
  1071. }
  1072. }
  1073. _VCS_INFO_SEM=target_macroses-ITEM && target_macroses-macro vcs_info && target_macroses-args ${hide;input:"build/scripts/vcs_info.py"} ${hide;input:"build/scripts/c_templates/svn_interface.c"} ${hide;input:"build/scripts/c_templates/svnversion.h"}
  1074. _CPP_PROGRAM_SEM=add_executable $MODDIR $CMAKE_TARGET_NAME ${hide:TARGET} ${hide:AUTO_INPUT} $CMAKE_TARGET_ARTEFACT_RENAME_RULES \
  1075. && ${_VCS_INFO_SEM} \
  1076. && target_options-privates-ITEM && target_options-privates-option target_link_options && target_options-privates-args $LDFLAGS_GLOBAL_RAW $LDFLAGS $OBJADDE_LIB $OBJADDE_LIB_GLOBAL $OBJADDE \
  1077. && target_options-privates-ITEM && target_options-privates-option target_include_directories && target_options-privates-args $_C__INCLUDE_OWNED \
  1078. && target_options-privates-ITEM && target_options-privates-option target_compile_options && target_options-privates-args $USER_CFLAGS $USER_CXXFLAGS $_SEM_EXTRA_CXX_FLAGS \
  1079. && target_options-privates-ITEM && target_options-privates-option target_compile_options && target_options-privates-args $USER_CFLAGS_GLOBAL_RAW $USER_CXXFLAGS_GLOBAL_RAW \
  1080. && target_options-privates-ITEM && target_options-privates-option target_sources && target_options-privates-args ${MODULE_EXPLICIT_HEADERS}
  1081. ### @usage: PROGRAM([progname])
  1082. ###
  1083. ### Regular program module.
  1084. ### If name is not specified it will be generated from the name of the containing project directory.
  1085. module PROGRAM: _BASE_PROGRAM {
  1086. .SEM=_CPP_PROGRAM_SEM
  1087. .ALIASES=EXTRALIBS=PY_EXTRALIBS
  1088. ADD_YTEST($MODULE_PREFIX$REALPRJNAME coverage.extractor)
  1089. _DONT_REQUIRE_LICENSE()
  1090. WITHOUT_VERSION()
  1091. }
  1092. ### @usage: EXPORTS_SCRIPT(exports_file)
  1093. ###
  1094. ### Specify exports script within PROGRAM, DLL and DLL-derived modules.
  1095. ### This accepts 2 kind of files: .exports with <lang symbol> pairs and JSON-line .symlist files.
  1096. ### The other option use EXPORTS parameter of the DLL module itself.
  1097. ###
  1098. ### @see: [DLL](#module_DLL)
  1099. macro EXPORTS_SCRIPT(Arg) {
  1100. SET(EXPORTS_FILE $Arg)
  1101. }
  1102. ### @usage: NO_EXPORT_DYNAMIC_SYMBOLS()
  1103. ###
  1104. ### Disable exporting all non-hidden symbols as dynamic when linking a PROGRAM.
  1105. macro NO_EXPORT_DYNAMIC_SYMBOLS() {
  1106. ENABLE(NO_EXPORT_DYNAMIC_SYMBOLS)
  1107. }
  1108. ### @usage: EXPORT_ALL_DYNAMIC_SYMBOLS()
  1109. ###
  1110. ### Export all non-hidden symbols as dynamic when linking a PROGRAM.
  1111. macro EXPORT_ALL_DYNAMIC_SYMBOLS() {
  1112. # Dummy: default behaviour
  1113. ENABLE(EXPORT_ALL_DYNAMIC_SYMBOLS)
  1114. }
  1115. ### @usage: USE_DYNAMIC_CUDA()
  1116. ###
  1117. ### Enable linking of PROGRAM with dynamic CUDA. By default CUDA uses static linking
  1118. macro USE_DYNAMIC_CUDA() {
  1119. LDFLAGS(-Wl,-rpath,$ORIGIN)
  1120. ENABLE(USE_DYNAMIC_CUDA)
  1121. }
  1122. ### @usage: CUSTOM_LINK_STEP_SCRIPT(name)
  1123. ###
  1124. ### Specifies name of a script for custom link step. The scripts
  1125. ### should be placed in the build/scripts directory and are subject to
  1126. ### review by devtools@.
  1127. macro CUSTOM_LINK_STEP_SCRIPT(Name) {
  1128. SET(_CUSTOM_LINK_STEP_SCRIPT build/scripts/$Name)
  1129. }
  1130. ### @usage: _BASE_UNITTEST # internal
  1131. ###
  1132. ### Module with base logic for all unit-test modules: it makes code runnable as unit-test by Arcadia testing machinery.
  1133. module _BASE_UNITTEST: _BASE_PROGRAM {
  1134. .FINAL_TARGET=no
  1135. .NODE_TYPE=Program
  1136. .ALLOWED=YT_SPEC
  1137. .DEFAULT_NAME_GENERATOR=FullPath
  1138. when ($UT_SKIP_EXCEPTIONS == "yes") {
  1139. C_DEFINES+=-DUT_SKIP_EXCEPTIONS
  1140. }
  1141. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS canondata/result.json)
  1142. # Assume that no code may depend on unit test output and thus
  1143. # do not mandate license markup in such modules.
  1144. _DONT_REQUIRE_LICENSE()
  1145. WITHOUT_VERSION()
  1146. }
  1147. _TEST_SPLIT_FACTOR_SEM=1
  1148. _TEST_TIMEOUT_SEM=
  1149. _TEST_PARTITION_SEM=
  1150. _UNITTEST_SEM=$_CPP_PROGRAM_SEM \
  1151. && target_commands-ITEM && target_commands-macro set_property && target_commands-args TARGET $REALPRJNAME PROPERTY SPLIT_FACTOR $_TEST_SPLIT_FACTOR_SEM \
  1152. $_TEST_PARTITION_SEM \
  1153. && target_commands-ITEM && target_commands-macro add_yunittest && target_commands-args NAME $REALPRJNAME TEST_TARGET $REALPRJNAME TEST_ARG --print-before-suite --print-before-test --fork-tests --print-times --show-fails \
  1154. && target_commands-ITEM && target_commands-macro set_yunittest_property && target_commands-args TEST $REALPRJNAME PROPERTY LABELS $TEST_SIZE_NAME $FILTER_ONLY_TEST_TAGS \
  1155. && add_ytest_requirements $REALPRJNAME $DEFAULT_REQUIREMENTS $TEST_REQUIREMENTS_VALUE \
  1156. && target_commands-ITEM && target_commands-macro set_yunittest_property && target_commands-args TEST $REALPRJNAME PROPERTY ENVIRONMENT && target_commands-args_escaped $TEST_ENV_VALUE \
  1157. $_TEST_TIMEOUT_SEM
  1158. # tag:test
  1159. ### @usage: UNITTEST([name])
  1160. ###
  1161. ### Unit test module based on library/cpp/testing/unittest.
  1162. ### It is recommended not to specify the name.
  1163. ###
  1164. ### Documentation: https://wiki.yandex-team.ru/yatool/test/#opisanievya.make1
  1165. module UNITTEST: _BASE_UNITTEST {
  1166. .SEM=_UNITTEST_SEM
  1167. .ARGS_PARSER=Base
  1168. PEERDIR(library/cpp/testing/unittest_main)
  1169. ADD_YTEST($MODULE_PREFIX$REALPRJNAME unittest.py)
  1170. when ($TEST_FORK_MODE != "none") {
  1171. when ($TEST_SPLIT_FACTOR) {
  1172. _TEST_SPLIT_FACTOR_SEM=$TEST_SPLIT_FACTOR
  1173. }
  1174. otherwise {
  1175. _TEST_SPLIT_FACTOR_SEM=10
  1176. }
  1177. when ($TEST_PARTITION == "MODULO") {
  1178. _TEST_PARTITION_SEM=&& target_commands-ITEM && target_commands-macro set_property && target_commands-args TARGET $REALPRJNAME PROPERTY SPLIT_TYPE $TEST_PARTITION
  1179. }
  1180. }
  1181. when ($TEST_TIMEOUT) {
  1182. _TEST_TIMEOUT_SEM=&& target_commands-ITEM && target_commands-macro set_yunittest_property && target_commands-args TEST $REALPRJNAME PROPERTY TIMEOUT $TEST_TIMEOUT
  1183. }
  1184. }
  1185. # tag:yt-specific tag:test
  1186. ### @usage: YT_UNITTEST([name])
  1187. ###
  1188. ### YT Unit test module based on library/cpp/testing/unittest with NYT::Initialize hook
  1189. module YT_UNITTEST: _BASE_UNITTEST {
  1190. .SEM=_UNITTEST_SEM
  1191. PEERDIR(library/cpp/testing/unittest_main yt/cpp/mapreduce/tests/yt_initialize_hook)
  1192. ADD_YTEST($MODULE_PREFIX$REALPRJNAME unittest.py)
  1193. }
  1194. # tag:test
  1195. ### @usage: UNITTEST_WITH_CUSTOM_ENTRY_POINT([name])
  1196. ###
  1197. ### Generic unit test module.
  1198. module UNITTEST_WITH_CUSTOM_ENTRY_POINT: _BASE_UNITTEST {
  1199. .SEM=_UNITTEST_SEM
  1200. ADD_YTEST($MODULE_PREFIX$REALPRJNAME unittest.py)
  1201. }
  1202. _GTEST_SEM=$_CPP_PROGRAM_SEM \
  1203. && target_commands-ITEM && target_commands-macro add_test && target_commands-args NAME $REALPRJNAME COMMAND $REALPRJNAME \
  1204. && target_commands-ITEM && target_commands-macro set_property && target_commands-args TEST $REALPRJNAME PROPERTY LABELS $TEST_SIZE_NAME $FILTER_ONLY_TEST_TAGS \
  1205. && add_test_requirements $REALPRJNAME $DEFAULT_REQUIREMENTS $TEST_REQUIREMENTS_VALUE \
  1206. && target_commands-ITEM && target_commands-macro set_property && target_commands-args TEST $REALPRJNAME PROPERTY ENVIRONMENT && target_commands-args_escaped $TEST_ENV_VALUE \
  1207. $_TEST_TIMEOUT_SEM
  1208. # tag:cpp-specific tag:test
  1209. ### @usage: GTEST([name])
  1210. ###
  1211. ### Unit test module based on library/cpp/testing/gtest.
  1212. ### It is recommended not to specify the name.
  1213. ###
  1214. ### Documentation: https://docs.yandex-team.ru/arcadia-cpp/docs/build/manual/tests/cpp#gtest
  1215. module GTEST: _BASE_UNITTEST {
  1216. .SEM=_GTEST_SEM
  1217. .DEFAULT_NAME_GENERATOR=FullPath
  1218. .ARGS_PARSER=Base
  1219. PEERDIR(library/cpp/testing/gtest library/cpp/testing/gtest_main)
  1220. ADD_YTEST($MODULE_PREFIX$REALPRJNAME gunittest)
  1221. when ($TEST_TIMEOUT) {
  1222. _TEST_TIMEOUT_SEM=&& target_commands-ITEM && target_commands-macro set_property && target_commands-args TEST $REALPRJNAME PROPERTY TIMEOUT $TEST_TIMEOUT
  1223. }
  1224. }
  1225. USE_AFL=no
  1226. # tag:fuzzing
  1227. ### @usage: FUZZ()
  1228. ###
  1229. ### In order to start using Fuzzing in Arcadia, you need to create a FUZZ module with the implementation of the function LLVMFuzzerTestOneInput().
  1230. ### This module should be reachable by RECURSE from /autocheck project in order for the corpus to be regularly updated.
  1231. ### AFL and Libfuzzer are supported in Arcadia via a single interface, but the automatic fuzzing still works only through Libfuzzer.
  1232. ###
  1233. ### Example: https://a.yandex-team.ru/arc/trunk/arcadia/contrib/libs/re2/re2/fuzzing/re2_fuzzer.cc?rev=2919463#L58
  1234. ###
  1235. ### Documentation: https://wiki.yandex-team.ru/yatool/fuzzing/
  1236. module FUZZ: _BASE_PROGRAM {
  1237. .NODE_TYPE=Program
  1238. .FINAL_TARGET=no
  1239. .ALLOWED=FUZZ_DICTS FUZZ_OPTS
  1240. SET(LIBFUZZER_PATH contrib/libs/libfuzzer)
  1241. when ($USE_AFL == "no") {
  1242. PEERDIR+=$LIBFUZZER_PATH
  1243. }
  1244. when ($USE_AFL == "yes") {
  1245. PEERDIR+=$LIBFUZZER_PATH/afl
  1246. }
  1247. when (!$SANITIZER_TYPE || $SANITIZER_TYPE == "no") {
  1248. PEERDIR+=library/cpp/testing/nofuzz
  1249. }
  1250. ADD_YTEST($MODULE_PREFIX$REALPRJNAME fuzz.test)
  1251. }
  1252. # tag:ios-specific
  1253. PACK_IOS_CMD=
  1254. when ($OS_IOS && $BUILD_IOS_APP) {
  1255. PACK_IOS_CMD=$YMAKE_PYTHON ${input:"build/scripts/pack_ios.py"} --binary $TARGET --target $TARGET --temp-dir $BINDIR $PEERS
  1256. }
  1257. LINK_BOOSTTEST_CMD=
  1258. BOOST_TEST_TYPE_STRING=
  1259. when ($BOOSTTEST_IS_FAT_OBJECT) {
  1260. LINK_BOOSTTEST_CMD=$LINK_RECURSIVE_LIBRARY
  1261. BOOST_TEST_TYPE_STRING=no.test
  1262. }
  1263. otherwise {
  1264. LINK_BOOSTTEST_CMD=$LINK_EXE
  1265. BOOST_TEST_TYPE_STRING=boost.test
  1266. }
  1267. # tag:deprecated
  1268. ### @usage: BOOSTTEST([name]) #deprecated
  1269. ###
  1270. ### Test module based on boost/test/unit_test.hpp.
  1271. ### As with entire boost library usage of this technology is deprecated in Arcadia and restricted with configuration error in most of projects.
  1272. ### No new module of this type should be introduced unless it is explicitly approved by C++ committee.
  1273. module BOOSTTEST: _BASE_PROGRAM {
  1274. .NODE_TYPE=Program
  1275. .FINAL_TARGET=no
  1276. .CMD=$LINK_BOOSTTEST_CMD
  1277. PEERDIR(library/cpp/testing/boost_test)
  1278. when ($BOOSTTEST_IS_FAT_OBJECT) {
  1279. MODULE_SUFFIX=.a
  1280. }
  1281. elsewhen ($OS_IOS && $BUILD_IOS_APP) {
  1282. PEERDIR+=devtools/boosttest_ios_wrapper/library
  1283. MODULE_SUFFIX=.ios.tar
  1284. }
  1285. ADD_YTEST($MODULE_PREFIX$REALPRJNAME $BOOST_TEST_TYPE_STRING)
  1286. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS canondata/result.json)
  1287. _DONT_REQUIRE_LICENSE()
  1288. WITHOUT_VERSION()
  1289. }
  1290. # tag:deprecated
  1291. ### @usage: BOOSTTEST_WITH_MAIN([name]) #deprecated
  1292. ###
  1293. ### Same as BOOSTTEST (see above), but comes with builtin int main(argc, argv) implementation
  1294. module BOOSTTEST_WITH_MAIN: BOOSTTEST {
  1295. PEERDIR(library/cpp/testing/boost_test_main)
  1296. }
  1297. FUZZ_DICTS_VALUE=
  1298. ### @usage: FUZZ_DICTS(path1 [path2...])
  1299. ###
  1300. ### Allows you to specify dictionaries, relative to the root of Arcadia, which will be used in Fuzzing.
  1301. ### Libfuzzer and AFL use a single syntax for dictionary descriptions.
  1302. ### Should only be used in FUZZ modules.
  1303. ###
  1304. ### Documentation: https://wiki.yandex-team.ru/yatool/fuzzing/
  1305. macro FUZZ_DICTS(Data...) {
  1306. SET_APPEND(FUZZ_DICTS_VALUE $Data)
  1307. }
  1308. FUZZ_OPTS_VALUE=
  1309. ### @usage: FUZZ_OPTS(opt1 [Opt2...])
  1310. ###
  1311. ### Overrides or adds options to the corpus mining and fuzzer run.
  1312. ### Currently supported only Libfuzzer, so you should use the options for it.
  1313. ### Should only be used in FUZZ modules.
  1314. ###
  1315. ### @example:
  1316. ###
  1317. ### FUZZ_OPTS (
  1318. ### -max_len=1024
  1319. ### -rss_limit_mb=8192
  1320. ### )
  1321. ###
  1322. ### Documentation: https://wiki.yandex-team.ru/yatool/fuzzing/
  1323. macro FUZZ_OPTS(Data...) {
  1324. SET_APPEND(FUZZ_OPTS_VALUE $Data)
  1325. }
  1326. # tag:yt-specific tag:test
  1327. TEST_YT_SPEC_VALUE=
  1328. ### @usage: YT_SPEC(path1 [path2...])
  1329. ###
  1330. ### Allows you to specify json-files with YT task and operation specs,
  1331. ### which will be used to run test node in the YT.
  1332. ### Test must be marked with ya:yt tag.
  1333. ### Files must be relative to the root of Arcadia.
  1334. ###
  1335. ### Documentation: https://wiki.yandex-team.ru/yatool/test/
  1336. macro YT_SPEC(Data...) {
  1337. SET_APPEND(TEST_YT_SPEC_VALUE $Data)
  1338. }
  1339. # tag:test
  1340. TEST_SRCS_VALUE=
  1341. ### @usage: TEST_SRCS(Files...)
  1342. ###
  1343. ### In PY2TEST, PY3TEST and PY*_LIBRARY modules used as PY_SRCS macro and additionally used to mine test cases to be executed by testing framework.
  1344. ###
  1345. ### Documentation: https://wiki.yandex-team.ru/yatool/test/#testynapytest
  1346. macro TEST_SRCS(Tests...) {
  1347. SET_APPEND(TEST_SRCS_VALUE $Tests)
  1348. }
  1349. macro DISABLE_DATA_VALIDATION() {
  1350. DISABLE(VALIDATE_DATA)
  1351. }
  1352. # tag:test
  1353. TEST_DATA_VALUE=
  1354. ### @usage: DATA([path...])
  1355. ###
  1356. ### Specifies the path to the data necessary test.
  1357. ### Valid values are: arcadia/<path> , arcadia_tests_data/<path> and sbr://<resource_id>.
  1358. ### In the latter case resource will be brought to the working directory of the test before it is started
  1359. ###
  1360. ### Used only inside TEST modules.
  1361. ###
  1362. ### Documentation: https://wiki.yandex-team.ru/yatool/test/#dannyeizrepozitorija
  1363. macro DATA(Data...) {
  1364. SET_APPEND(TEST_DATA_VALUE $Data)
  1365. ADD_CHECK(check.data $Data)
  1366. }
  1367. DOCKER_IMAGES_VALUE=
  1368. macro DOCKER_IMAGE(Images...) {
  1369. SET_APPEND(DOCKER_IMAGES_VALUE $Images)
  1370. }
  1371. # tag:test
  1372. ### @usage: DATA_FILES([path...])
  1373. ###
  1374. ### Specifies the path to the arcadia source data necessary test.
  1375. ### Used only inside TEST modules.
  1376. ###
  1377. ### Documentation: https://wiki.yandex-team.ru/yatool/test/#dannyeizrepozitorija
  1378. macro DATA_FILES(Paths...) {
  1379. SET_APPEND(TEST_DATA_VALUE ${pre=arcadia/:Paths})
  1380. _DATA_FILES($Paths)
  1381. }
  1382. # tag:test
  1383. ### @usage: EXPLICIT_DATA()
  1384. ###
  1385. ### Disables implicit macro DATA(<module_path>).
  1386. ADD_SRCDIR_TO_TEST_DATA=yes
  1387. macro EXPLICIT_DATA() {
  1388. SET(ADD_SRCDIR_TO_TEST_DATA no)
  1389. }
  1390. # tag:test
  1391. TEST_TAGS_VALUE=
  1392. ### @usage: TAG ([tag...])
  1393. ###
  1394. ### Each test can have one or more tags used to filter tests list for running.
  1395. ### There are also special tags affecting test behaviour, for example ya:external, sb:ssd.
  1396. ###
  1397. ### Documentation: https://wiki.yandex-team.ru/yatool/test/#obshhieponjatija
  1398. macro TAG(Tags...) {
  1399. SET_APPEND(TEST_TAGS_VALUE $Tags)
  1400. }
  1401. # tag:test
  1402. TEST_REQUIREMENTS_VALUE=
  1403. ### @usage: REQUIREMENTS([cpu:<count>] [disk_usage:<size>] [ram:<size>] [ram_disk:<size>] [container:<id>] [network:<restricted|full>] [dns:dns64])
  1404. ###
  1405. ### Allows you to specify the requirements of the test.
  1406. ###
  1407. ### Documentation about the Arcadia test system: https://wiki.yandex-team.ru/yatool/test/
  1408. macro REQUIREMENTS(Tags...) {
  1409. SET_APPEND(TEST_REQUIREMENTS_VALUE $Tags)
  1410. }
  1411. # tag:test
  1412. TEST_ENV_VALUE=
  1413. ### @usage: ENV(key[=value])
  1414. ###
  1415. ### Sets env variable key to value (gets value from system env by default).
  1416. macro ENV(Data...) {
  1417. SET_APPEND(TEST_ENV_VALUE ${quo:Data})
  1418. }
  1419. ### @usage: CONFTEST_LOAD_POLICY_LOCAL()
  1420. ###
  1421. ### Loads conftest.py files in a way that pytest does it
  1422. macro CONFTEST_LOAD_POLICY_LOCAL() {
  1423. SET_APPEND(TEST_ENV_VALUE "CONFTEST_LOAD_POLICY=LOCAL")
  1424. }
  1425. # tag:test
  1426. TEST_RECIPES_VALUE=
  1427. ### @usage: USE_RECIPE(path [arg1 arg2...])
  1428. ###
  1429. ### Provides prepared environment via recipe for test.
  1430. ###
  1431. ### Documentation: https://wiki.yandex-team.ru/yatool/test/recipes
  1432. macro USE_RECIPE(Data...) {
  1433. SET_APPEND(TEST_RECIPES_VALUE $Data)
  1434. SET_APPEND(TEST_RECIPES_VALUE "USE_RECIPE_DELIM")
  1435. }
  1436. # tag:python-specific tag:test
  1437. TEST_PYTHON_PATH_VALUE=
  1438. # tag:python-specific tag:test
  1439. ### @usage: PYTHON_PATH(Path)
  1440. ###
  1441. ### Set path to Python that will be used to runs scripts in tests
  1442. macro PYTHON_PATH(Path) {
  1443. SET(TEST_PYTHON_PATH_VALUE $Path)
  1444. }
  1445. # tag:test
  1446. SKIP_TEST_VALUE=
  1447. ### @usage: SKIP_TEST(Reason)
  1448. ###
  1449. ### Skip the suite defined by test module. Provide a reason to be output in test execution report.
  1450. macro SKIP_TEST(Reason...) {
  1451. SET(SKIP_TEST_VALUE $Reason)
  1452. }
  1453. # tag:test
  1454. LINT_LEVEL_VALUE=extended
  1455. _NO_LINT_VALUE=
  1456. ### @usage: NO_LINT([ktlint])
  1457. ###
  1458. ### Do not check for style files included in PY_SRCS, TEST_SRCS, JAVA_SRCS.
  1459. ### Ktlint can be disabled using NO_LINT(ktlint) explicitly.
  1460. macro NO_LINT(ktlint?"ktlint":"none") {
  1461. SET(_NO_LINT_VALUE ${ktlint})
  1462. }
  1463. ### @usage: LINT(<none|base|strict|extended>)
  1464. ###
  1465. ### Set linting level for sources of the module
  1466. macro LINT(level) {
  1467. SET(LINT_LEVEL_VALUE $level)
  1468. }
  1469. macro STYLE(Globs...) {
  1470. _GLOB(STYLE_SRCS_GLOB ${pre=${ARCADIA_ROOT}:Globs})
  1471. _STYLE(${STYLE_SRCS_GLOB})
  1472. }
  1473. # tag:test
  1474. ### @usage: EXECTEST()
  1475. ###
  1476. ### Module definition of generic test that executes a binary.
  1477. ### Use macro RUN to specify binary to run.
  1478. ###
  1479. ### @example:
  1480. ###
  1481. ### EXECTEST()
  1482. ### OWNER(g:yatool)
  1483. ###
  1484. ### RUN(
  1485. ### cat input.txt
  1486. ### )
  1487. ### DATA(
  1488. ### arcadia/devtools/ya/test/tests/exectest/data
  1489. ### )
  1490. ### DEPENDS(
  1491. ### devtools/dummy_arcadia/cat
  1492. ### )
  1493. ### TEST_CWD(devtools/ya/test/tests/exectest/data)
  1494. ### END()
  1495. ###
  1496. ### More examples: https://wiki.yandex-team.ru/yatool/test/#exec-testy
  1497. ###
  1498. ### @see: [RUN()](#macro_RUN)
  1499. module EXECTEST: _BARE_UNIT {
  1500. .NODE_TYPE=Program
  1501. .FINAL_TARGET=no
  1502. .ALLOWED=YT_SPEC
  1503. .RESTRICTED=FORK_TEST_FILES
  1504. .DEFAULT_NAME_GENERATOR=FullPath
  1505. .ARGS_PARSER=Base
  1506. SET(MODULE_SUFFIX .pkg.fake)
  1507. SETUP_EXECTEST()
  1508. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS canondata/result.json)
  1509. }
  1510. # tag:cpp-specific tag:test
  1511. ### @usage: Y_BENCHMARK([benchmarkname])
  1512. ###
  1513. ### Benchmark test based on the library/cpp/testing/benchmark.
  1514. ###
  1515. ### For more details see: https://wiki.yandex-team.ru/yatool/test/#zapuskbenchmark
  1516. module Y_BENCHMARK: PROGRAM {
  1517. .SEM=_CPP_PROGRAM_SEM
  1518. PEERDIR(library/cpp/testing/benchmark/main)
  1519. ADD_YTEST($MODULE_PREFIX$REALPRJNAME y_benchmark)
  1520. }
  1521. _GBENCH_SEM=$_CPP_PROGRAM_SEM \
  1522. && target_commands-ITEM && target_commands-macro add_test && target_commands-args NAME $REALPRJNAME COMMAND $REALPRJNAME \
  1523. && target_commands-ITEM && target_commands-macro set_property && target_commands-args TEST $REALPRJNAME PROPERTY LABELS SMALL $FILTER_ONLY_TEST_TAGS \
  1524. && add_test_requirements $REALPRJNAME $DEFAULT_REQUIREMENTS $TEST_REQUIREMENTS_VALUE \
  1525. $_TEST_TIMEOUT_SEM
  1526. # tag:cpp-specific tag:test
  1527. ### @usage: G_BENCHMARK([benchmarkname])
  1528. ###
  1529. ### Benchmark test based on the google benchmark.
  1530. ###
  1531. ### For more details see: https://a.yandex-team.ru/arc/trunk/arcadia/contrib/libs/benchmark/README.md
  1532. module G_BENCHMARK: _BASE_PROGRAM {
  1533. .SEM=_GBENCH_SEM
  1534. .ALLOWED=YT_SPEC
  1535. PEERDIR(library/cpp/testing/gbenchmark)
  1536. ADD_YTEST($MODULE_PREFIX$REALPRJNAME g_benchmark)
  1537. }
  1538. BENCHMARK_OPTS_VALUE=
  1539. ### @usage: BENCHMARK_OPTS(opt1 [opt2...])
  1540. ###
  1541. ### Allows to specify extra args to benchmark binary.
  1542. ### Supported for G_BENCHMARK and Y_BENCHMARK
  1543. ###
  1544. ### @example:
  1545. ### BENCHMARK_OPTS (
  1546. ### --benchmark_min_time=0
  1547. ### )
  1548. ###
  1549. ### Documentation: https://docs.yandex-team.ru/ya-make/manual/tests/benchmark
  1550. macro BENCHMARK_OPTS(Data...) {
  1551. SET_APPEND(BENCHMARK_OPTS_VALUE $Data)
  1552. }
  1553. # tag:test
  1554. TEST_ROOT=$(TESTS_DATA_ROOT)
  1555. RESULT_MAX_FILE=0
  1556. STRIP_FILES=--dont-strip-files
  1557. VERIFY_RESULTS=--verify-results
  1558. ADDITIONAL_PATH=
  1559. # set for tests variables to fill it by YA_DEV or YA
  1560. YA_ROOT=ya
  1561. when ($YA_DEV == "yes") {
  1562. YA_ROOT=ya-dev
  1563. }
  1564. # tag:test
  1565. ### @usage: UNITTEST_FOR(path/to/lib)
  1566. ###
  1567. ### Convenience extension of UNITTEST module.
  1568. ### The UNINTTEST module with additional SRCDIR + ADDINCL + PEERDIR on path/to/lib.
  1569. ### path/to/lib is the path to the directory with the LIBRARY project.
  1570. ###
  1571. ### Documentation about the Arcadia test system: https://wiki.yandex-team.ru/yatool/test/
  1572. module UNITTEST_FOR: UNITTEST {
  1573. .SEM=_UNITTEST_SEM
  1574. PEERDIR(ADDINCL $UNITTEST_DIR)
  1575. SRCDIR($UNITTEST_DIR)
  1576. }
  1577. ### @usage: _LIBRARY # internal
  1578. ###
  1579. ### Base module definition for all libraries.
  1580. ### Contains basic logic like module properties, default variable values etc.
  1581. ### All libraries similar to C++-libraries should be inherited from it.
  1582. module _LIBRARY: _BASE_UNIT {
  1583. .CMD=$LINK_LIB
  1584. .STRUCT_CMD=yes
  1585. .NODE_TYPE=Library
  1586. .PEERDIR_POLICY=as_include
  1587. .EXTS=.o .obj .a .mf .supp .sbom .tidyjson .ld .lib .sdcmeta .pyplugin
  1588. .ALLOWED=GRPC USE_SKIFF EXTRALIBS OBJADDE_GLOBAL RESOURCE_FILES
  1589. .GLOBAL=USER_CFLAGS USER_CXXFLAGS USER_CONLYFLAGS LDFLAGS SRCS _WHOLE_ARCHIVE_LIBS_VALUE RPATH OBJADDE_LIB _LINK_EXCLUDE_LIBRARIES
  1590. .RESTRICTED=ALLOCATOR SIZE TAG DATA TEST_DATA DEPENDS FORK_TESTS FORK_SUBTESTS SPLIT_FACTOR TEST_CWD RUN TIMEOUT SPLIT_DWARF
  1591. .ALIASES=EXTRALIBS=PY_EXTRALIBS
  1592. .FINAL_TARGET=no
  1593. .GLOBAL_CMD=$GLOBAL_LINK_LIB
  1594. .GLOBAL_EXTS=.o .obj .tidyjson
  1595. GLOBAL_SUFFIX=.global$MODULE_SUFFIX
  1596. #TODO: Remove this hack (really we do not need add fake src at all)
  1597. ENABLE(NEED_ADD_FAKE_SRC)
  1598. CHECK_CONTRIB_CREDITS(contrib/clickhouse contrib/libs contrib/deprecated EXCEPT contrib/deprecated/python)
  1599. when ($USE_MKL == "yes") {
  1600. NOPLATFORM=yes
  1601. }
  1602. when ($MSVC == "yes" || $CYGWIN == "yes") {
  1603. MODULE_PREFIX=
  1604. MODULE_SUFFIX=.lib
  1605. }
  1606. elsewhen ($TIDY_ENABLED == "yes") {
  1607. MODULE_PREFIX=
  1608. MODULE_SUFFIX=.tidyjson
  1609. }
  1610. otherwise {
  1611. MODULE_PREFIX=lib
  1612. MODULE_SUFFIX=.a
  1613. }
  1614. when ($WITH_VALGRIND == "yes") {
  1615. PEERDIR+=contrib/libs/valgrind
  1616. # https://st.yandex-team.ru/DTCC-1227
  1617. CFLAGS+=-fdebug-default-version=4
  1618. }
  1619. }
  1620. CPP_LIBRARY_INDUCED_LINKS=link-publics
  1621. _CPP_LIBRARY_SEM=add_library ${MODDIR} $CMAKE_TARGET_NAME ${hide:TARGET} ${hide:AUTO_INPUT} $CMAKE_TARGET_ARTEFACT_RENAME_RULES \
  1622. && is_fake_module ${FAKE_MODULE} \
  1623. && ${CPP_LIBRARY_INDUCED_LINKS} $CMAKE_LINK_TARGET \
  1624. && target_options-publics-ITEM && target_options-publics-option target_include_directories && target_options-publics-args $_C__INCLUDE_GLOBAL \
  1625. && target_options-privates-ITEM && target_options-privates-option target_include_directories && target_options-privates-args $_C__INCLUDE_OWNED \
  1626. && target_options-privates-ITEM && target_options-privates-option target_compile_options && target_options-privates-args $USER_CFLAGS $USER_CXXFLAGS $_SEM_EXTRA_CXX_FLAGS \
  1627. && target_options-publics-ITEM && target_options-publics-option target_compile_options && target_options-publics-args $USER_CFLAGS_GLOBAL_RAW $USER_CXXFLAGS_GLOBAL_RAW \
  1628. && target_options-interfaces-ITEM && target_options-interfaces-option target_link_options && target_options-interfaces-args $LDFLAGS_GLOBAL_RAW \
  1629. && project_languages C && project_languages CXX \
  1630. && target_options-privates-ITEM && target_options-privates-option target_sources && target_options-privates-args ${MODULE_EXPLICIT_HEADERS}
  1631. _CPP_OBJ_LIBRARY_SEM=add_global_library_for ${MODDIR} ${suf=.global:CMAKE_TARGET_NAME} $CMAKE_TARGET_NAME ${hide:GLOBAL_TARGET} ${hide:AUTO_INPUT} \
  1632. && target_options-publics-ITEM && target_options-publics-option target_include_directories && target_options-publics-args $_C__INCLUDE_GLOBAL \
  1633. && target_options-privates-ITEM && target_options-privates-option target_include_directories && target_options-privates-args $_C__INCLUDE_OWNED \
  1634. && target_options-privates-ITEM && target_options-privates-option target_compile_options && target_options-privates-args $USER_CFLAGS $USER_CXXFLAGS $_SEM_EXTRA_CXX_FLAGS \
  1635. && target_options-publics-ITEM && target_options-publics-option target_compile_options && target_options-publics-args $USER_CFLAGS_GLOBAL_RAW $USER_CXXFLAGS_GLOBAL_RAW
  1636. CMAKE_FIND_PKG=
  1637. CMAKE_LINK_TARGET=$REALPRJNAME
  1638. CMAKE_FIND_PKG_COMP=
  1639. ### @usage: LIBRARY()
  1640. ###
  1641. ### The regular static library module.
  1642. ###
  1643. ### The LIBRARY() is intermediate module, so when built directly it won't build its dependencies.
  1644. ### It transitively provides its PEERDIRs to ultimate final target, where all LIBRARY() modules are built and linked together.
  1645. ###
  1646. ### This is C++ library, and it selects peers from multimodules accordingly.
  1647. ###
  1648. ### It makes little sense to mention LIBRARY in DEPENDS or BUNDLE, package and deploy it since it is not a standalone entity.
  1649. ### In order to use library in tests PEERDIR it to link into tests.
  1650. ### If you think you need to distribute static library please contact devtools@ for assistance.
  1651. module LIBRARY: _LIBRARY {
  1652. .GLOBAL=_AARS _PROGUARD_RULES
  1653. .SEM=_CPP_LIBRARY_SEM
  1654. .ALIASES=EXTRALIBS=PY_EXTRALIBS
  1655. .GLOBAL_SEM=_CPP_OBJ_LIBRARY_SEM
  1656. .DEFAULT_NAME_GENERATOR=ThreeDirNames
  1657. .ARGS_PARSER=Base
  1658. when ($CMAKE_PACKAGE_SEM != "" || $CONAN_REQUIRES_SEM != "" || $CONAN_OPTS_SEM != "" || $CONAN_OS_REQUIRES_SEM != "" || $CONAN_OS_OPTIONS_SEM != "") {
  1659. _CPP_LIBRARY_SEM=$CMAKE_PACKAGE_SEM && ${CPP_LIBRARY_INDUCED_LINKS} $CMAKE_LINK_TARGET $CONAN_REQUIRES_SEM $CONAN_OPTIONS_SEM $CONAN_OS_REQUIRES_SEM $CONAN_OS_OPTIONS_SEM && IGNORED
  1660. }
  1661. when ($OPENSOURCE_EXPORT == "no") {
  1662. _CPP_LIBRARY_SEM=$_SEM_IGNORED
  1663. }
  1664. when ($HAS_CPP_PROTOBUF_PEERS == "yes") {
  1665. PEERDIR+=$CPP_PROTOBUF_PEERS
  1666. }
  1667. SET(MODULE_TYPE LIBRARY)
  1668. SET(MODULE_LANG CPP)
  1669. ADD_CLANG_TIDY()
  1670. when ($TIDY_ENABLED == "yes") {
  1671. _MAKEFILE_INCLUDE_LIKE_DEPS+=${ARCADIA_ROOT}/build/yandex_specific/config/clang_tidy/tidy_project_map.json
  1672. _MAKEFILE_INCLUDE_LIKE_DEPS+=${ARCADIA_ROOT}/build/yandex_specific/config/clang_tidy/tidy_default_map.json
  1673. }
  1674. }
  1675. # tag:internal
  1676. ### @usage: _BARE_MODULE() # internal
  1677. ###
  1678. ### Remove unwanted dependencies for "empty" library module
  1679. macro _BARE_MODULE() {
  1680. SET(NEED_PLATFORM_PEERDIRS no)
  1681. SET(PEERDIR_TEST_TOOL no)
  1682. DISABLE(WITH_VALGRIND)
  1683. NO_CODENAVIGATION()
  1684. NO_PLATFORM()
  1685. NO_RUNTIME()
  1686. NO_UTIL()
  1687. NO_CLANG_TIDY()
  1688. }
  1689. # tag:internal
  1690. ### @usage: _BARE_LINK_MODULE() # internal
  1691. ###
  1692. ### Remove unwanted dependencies for "empty" link module
  1693. macro _BARE_LINK_MODULE() {
  1694. _BARE_MODULE()
  1695. DISABLE(COMMON_LINK_SETTINGS)
  1696. ALLOCATOR(FAKE)
  1697. }
  1698. # tag:internal
  1699. ### @usage: _CONDITIONAL_SRCS([USE_CONDITIONAL_SRCS] Files...) # internal
  1700. ###
  1701. ### Adds Files... to SRCS if first word is `USE_CONDITIONAL_SRCS`
  1702. ### To be used with some variable which is set to `USE_CONDITIONAL_SRCS` under condition
  1703. macro _CONDITIONAL_SRCS(USE_CONDITIONAL_SRCS[], DYMMY...) {
  1704. SRCS($USE_CONDITIONAL_SRCS)
  1705. }
  1706. # XXX: dirty hack for correct LDFLAGS passing
  1707. RESOURCES_LIBRARY_LINK=$TOUCH_UNIT
  1708. _RESOURCES_LIBRARY_SEM=IGNORED
  1709. ### @usage: RESOURCES_LIBRARY()
  1710. ###
  1711. ### Definition of a module that brings its content from external source (Sandbox) via DECLARE_EXTERNAL_RESOURCE macro.
  1712. ### This can participate in PEERDIRs of others as library but it cannot have own sources and PEERDIRs.
  1713. ###
  1714. ### @see: [DECLARE_EXTERNAL_RESOURCE()](#macro_DECLARE_EXTERNAL_RESOURCE)
  1715. module RESOURCES_LIBRARY: _BARE_UNIT {
  1716. .CMD=RESOURCES_LIBRARY_LINK
  1717. .SEM=_RESOURCES_LIBRARY_SEM
  1718. .ALLOWED=DECLARE_EXTERNAL_RESOURCE EXTRALIBS OBJADDE_GLOBAL
  1719. .RESTRICTED=ALLOCATOR SIZE TAG DATA TEST_DATA DEPENDS FORK_TESTS FORK_SUBTESTS SPLIT_FACTOR TEST_CWD RUN TIMEOUT SRC SRCS SPLIT_DWARF
  1720. .ALIASES=EXTRALIBS=PY_EXTRALIBS
  1721. .NODE_TYPE=Library
  1722. .PEERDIR_POLICY=as_include
  1723. .EXTS=.o .obj .a .mf .supp .sbom .tidyjson .ld .lib .pyplugin
  1724. .GLOBAL=USER_CFLAGS USER_CXXFLAGS USER_CONLYFLAGS LDFLAGS _WHOLE_ARCHIVE_LIBS_VALUE RPATH OBJADDE_LIB SRCS
  1725. SET(MODULE_TAG RESOURCE_LIB)
  1726. SET(PEERDIR_TAGS RESOURCE_LIB)
  1727. when ($CMAKE_PACKAGE_SEM != "" || $CONAN_REQUIRES_SEM != "" || $CONAN_OPTS_SEM != "" || $CONAN_OS_REQUIRES_SEM != "" || $CONAN_OS_OPTIONS_SEM != "") {
  1728. _RESOURCES_LIBRARY_SEM=$CMAKE_PACKAGE_SEM && ${CPP_LIBRARY_INDUCED_LINKS} $CMAKE_LINK_TARGET $CONAN_REQUIRES_SEM $CONAN_OPTIONS_SEM $CONAN_OS_REQUIRES_SEM $CONAN_OS_OPTIONS_SEM && IGNORED
  1729. }
  1730. MODULE_SUFFIX=.pkg.fake
  1731. ENABLE(NEED_ADD_FAKE_SRC)
  1732. WITHOUT_LICENSE_TEXTS()
  1733. }
  1734. _FAT_OBJECT_SEM=add_fat_object ${MODDIR} ${CMAKE_TARGET_NAME} ${hide:TARGET} ${hide:AUTO_INPUT} ${CMAKE_TARGET_ARTEFACT_RENAME_RULES} \
  1735. && target_options-privates-ITEM && target_options-privates-option target_include_directories && target_options-privates-args $_C__INCLUDE_OWNED \
  1736. && target_options-privates-ITEM && target_options-privates-option target_compile_options && target_options-privates-args $USER_CFLAGS $USER_CXXFLAGS $_SEM_EXTRA_CXX_FLAGS \
  1737. && platform_vars-FAT_OBJECT_PREFIX ${quo:MODULE_PREFIX} \
  1738. && platform_vars-FAT_OBJECT_SUFFIX ${quo:MODULE_SUFFIX}
  1739. ### Do not turn visibility=hidden symbos into static symbos of partially linked object file
  1740. ###
  1741. ### Note: This variable do not have any effect on platforms other than MacOS and iOS.
  1742. KEEP_FAT_OBJECT_SYMBOLS=no
  1743. ### @usage: FAT_OBJECT()
  1744. ###
  1745. ### The "fat" object module. It will contain all its transitive dependencies reachable by PEERDIRs:
  1746. ### static libraries, local (from own SRCS) and global (from peers') object files.
  1747. ###
  1748. ### Designed for use in XCode projects for iOS.
  1749. module FAT_OBJECT: LIBRARY {
  1750. .ALLOWED=PACK_GLOBALS_IN_LIBRARY
  1751. .CMD=$LINK_FAT_OBJECT
  1752. .SEM=_FAT_OBJECT_SEM
  1753. .PEERDIR_POLICY=as_build_from
  1754. when ($MSVC == "yes" || $CYGWIN == "yes") {
  1755. MODULE_SUFFIX=.lib
  1756. }
  1757. otherwise {
  1758. MODULE_SUFFIX=.a
  1759. }
  1760. when (($OS_DARWIN == "yes" || $OS_IOS == "yes") && $KEEP_FAT_OBJECT_SYMBOLS == "yes") {
  1761. LDFLAGS_GLOBAL += -keep_private_externs
  1762. }
  1763. when ($OS_IOS == "yes" || $OS_ANDROID == "yes" || $MAPSMOBI_BUILD_TARGET == "yes") {
  1764. MODULE_LICENSES_RESTRICTION_TYPES = ALLOW_ONLY
  1765. MODULE_LICENSES_RESTRICTIONS = SERVICE REQUIRE_CITATION
  1766. }
  1767. # FIXME: This is weird legacy
  1768. when ($OS_ANDROID == "yes") {
  1769. MODULE_PREFIX=lib
  1770. }
  1771. otherwise {
  1772. MODULE_PREFIX=
  1773. }
  1774. _USE_LINKER()
  1775. # This module requires at least one .o which is not subject to removal so just add _fake_src.cpp as SRCS
  1776. # ymake's handling of NEED_ADD_FAKE_SRC may insert arbitrary command, not necessarily compilation
  1777. DISABLE(NEED_ADD_FAKE_SRC)
  1778. SRCS(build/scripts/_fake_src.cpp)
  1779. }
  1780. _RECURSIVE_LIBRARY_SEM=add_recursive_library ${MODDIR} ${CMAKE_TARGET_NAME} ${hide:TARGET} ${hide:AUTO_INPUT} ${CMAKE_TARGET_ARTEFACT_RENAME_RULES} \
  1781. && target_options-publics-ITEM && target_options-publics-option target_include_directories && target_options-publics-args $_C__INCLUDE_GLOBAL \
  1782. && target_options-privates-ITEM && target_options-privates-option target_include_directories && target_options-privates-args $_C__INCLUDE_OWNED \
  1783. && target_options-privates-ITEM && target_options-privates-option target_compile_options && target_options-privates-args $USER_CFLAGS $USER_CXXFLAGS $_SEM_EXTRA_CXX_FLAGS \
  1784. && target_options-publics-ITEM && target_options-publics-option target_compile_options && target_options-publics-args $USER_CFLAGS_GLOBAL_RAW $USER_CXXFLAGS_GLOBAL_RAW \
  1785. && target_options-interfaces-ITEM && target_options-interfaces-option target_link_options && target_options-interfaces-args $LDFLAGS_GLOBAL_RAW
  1786. ### @usage: RECURSIVE_LIBRARY()
  1787. ###
  1788. ### The recursive ("fat") library module. It will contain all its transitive dependencies reachable by PEERDIRs:
  1789. ### from static libraries, local (from own SRCS) and global (from peers') object files.
  1790. ###
  1791. ### Designed for use in XCode projects for iOS.
  1792. module RECURSIVE_LIBRARY: LIBRARY {
  1793. .CMD=$LINK_RECURSIVE_LIBRARY
  1794. .SEM=_RECURSIVE_LIBRARY_SEM
  1795. .PEERDIR_POLICY=as_build_from
  1796. # This module requires at least one .o which is not subject to removal so just add _fake_src.cpp as SRCS
  1797. # ymake's handling of NEED_ADD_FAKE_SRC may insert arbitrary command, not necessarily compilation
  1798. DISABLE(NEED_ADD_FAKE_SRC)
  1799. SRCS(build/scripts/_fake_src.cpp)
  1800. }
  1801. _SONAME=
  1802. _EXPORT_SCRIPT_SEM=
  1803. _CLEAN_TEXTREL=
  1804. macro _ADD_DYNLYB_SEM(Libname) {
  1805. .SEM=add_shared_library ${MODDIR} ${Libname} ${hide:TARGET} ${hide:AUTO_INPUT} && target_options-publics-ITEM && target_options-publics-option target_include_directories && target_options-publics-args $_C__INCLUDE_GLOBAL && target_options-privates-ITEM && target_options-privates-option target_include_directories && target_options-privates-args $_C__INCLUDE_OWNED && target_options-privates-ITEM && target_options-privates-option target_compile_options && target_options-privates-args $USER_CFLAGS $USER_CXXFLAGS $_SEM_EXTRA_CXX_FLAGS && target_options-publics-ITEM && target_options-publics-option target_compile_options && target_options-publics-args $USER_CFLAGS_GLOBAL_RAW $USER_CXXFLAGS_GLOBAL_RAW && target_options-privates-ITEM && target_options-privates-option target_link_options && target_options-privates-args $LDFLAGS_GLOBAL_RAW $LDFLAGS $OBJADDE_LIB $OBJADDE_LIB_GLOBAL $OBJADDE && ${_VCS_INFO_SEM} $_EXPORT_SCRIPT_SEM
  1806. }
  1807. _CPP_DYN_LIBRARY_SEM=$_ADD_DYNLYB_SEM($CMAKE_TARGET_NAME) $CMAKE_TARGET_ARTEFACT_RENAME_RULES
  1808. macro CLEAN_TEXTREL() {
  1809. SET(_CLEAN_TEXTREL yes)
  1810. }
  1811. ### @usage: DLL_UNIT # internal
  1812. ###
  1813. ### Base module for all dynamically linked libraries as final artifacts.
  1814. ### Contains all general logic for such kind of modules. Supports versioning and export files.
  1815. ### Cannot participate in linking to programs, intended to be used as final artifact (packaged and deployed).
  1816. module DLL_UNIT: _LINK_UNIT {
  1817. .CMD=$LINK_DYN_LIB
  1818. .SEM=_CPP_DYN_LIBRARY_SEM
  1819. .NODE_TYPE=Library
  1820. .SYMLINK_POLICY=SO
  1821. .GLOBAL=USER_CFLAGS USER_CXXFLAGS USER_CONLYFLAGS LDFLAGS _WHOLE_ARCHIVE_LIBS_VALUE RPATH OBJADDE_LIB
  1822. .ALLOWED=WHOLE_ARCHIVE
  1823. .ALIASES=EXTRALIBS=PY_EXTRALIBS
  1824. .DEFAULT_NAME_GENERATOR=TwoDirNames
  1825. .ARGS_PARSER=DLL
  1826. DYNAMIC_LINK=yes
  1827. ALLOCATOR(FAKE)
  1828. SET(MODULE_TYPE DLL)
  1829. .TRANSITION=pic
  1830. SET(MODULE_TAG DLL)
  1831. SET(MODULE_LANG CPP)
  1832. when ($EXPORTS_FILE) {
  1833. _EXPORT_SCRIPT_SEM=&& target_macroses-ITEM && target_macroses-macro use_export_script && target_macroses-args ${input:EXPORTS_FILE}
  1834. }
  1835. when ($MSVC == "yes" || $CYGWIN == "yes") {
  1836. MODULE_SUFFIX=.dll
  1837. }
  1838. elsewhen ($DARWIN == "yes" || $OS_IOS == "yes") {
  1839. MODULE_PREFIX=lib
  1840. MODULE_SUFFIX=.dylib
  1841. }
  1842. elsewhen ($TIDY_ENABLED != "yes") {
  1843. MODULE_PREFIX=lib
  1844. MODULE_SUFFIX=.so
  1845. }
  1846. # This by now replicates ymake's behavior. We'll get rid of SONAME setting in ymake and fix this code altogether
  1847. SONAME=${pre=$MODULE_PREFIX;suf=$MODULE_SUFFIX:REALPRJNAME}
  1848. when ($MODULE_VERSION) {
  1849. LINK_DYN_LIB_FLAGS=--soname ${output;pre=$MODULE_PREFIX;suf=$MODULE_SUFFIX$MODULE_VERSION:REALPRJNAME}
  1850. }
  1851. _SONAME=$SONAME$MODULE_VERSION
  1852. when ($LINUX == "yes") {
  1853. # '-z notext' is needed for linking mkl into shared libraries
  1854. when ($_CLEAN_TEXTREL != "yes") {
  1855. LDFLAGS += -Wl,-z,notext
  1856. }
  1857. }
  1858. when ($OS_LINUX == "yes" && $ARCH_X86_64 == "yes") {
  1859. when ($_NO_FIX_ELF != "yes") {
  1860. LINK_DYN_LIB_FLAGS+=--fix-elf ${tool:"tools/fix_elf"}
  1861. }
  1862. }
  1863. when ($DARWIN == "yes") {
  1864. LDFLAGS += -undefined dynamic_lookup
  1865. }
  1866. when ($CLANG_COVERAGE && $CLANG_COVERAGE != "no") {
  1867. PEERDIR+=library/cpp/testing/dump_clang_coverage
  1868. }
  1869. when ($_CUSTOM_LINK_STEP_SCRIPT) {
  1870. LINK_DYN_LIB_FLAGS+=--python=$YMAKE_PYTHON --custom-step=${input:_CUSTOM_LINK_STEP_SCRIPT}
  1871. }
  1872. }
  1873. # tag:r-specific
  1874. ### @usage: R_MODULE(name major_ver [minor_ver] [EXPORTS symlist_file] [PREFIX prefix])
  1875. ###
  1876. ### The external module for R language.
  1877. ### 1. major_ver and minor_ver must be integers.
  1878. ### 2. The resulting .so will have the prefix "lib".
  1879. ### 3. Processing EXPORTS and PREFIX is the same as for DLL module
  1880. ### This is native DLL, so it will select C++ version from PROTO_LIBRARY.
  1881. module R_MODULE: DLL_UNIT {
  1882. .SEM=_CPP_DYN_LIBRARY_SEM
  1883. when ($DARWIN == "yes") {
  1884. LDFLAGS+=-flat_namespace -dynamiclib
  1885. }
  1886. when ($MSVC == "yes" || $CYGWIN == "yes") {
  1887. MODULE_PREFIX=lib
  1888. MODULE_SUFFIX=.dll
  1889. }
  1890. ADDINCL(contrib/libs/r-lang)
  1891. }
  1892. ### @usage: DYNAMIC_LIBRARY_FROM(Paths)
  1893. ###
  1894. ### Use specified libraries as sources of DLL
  1895. macro DYNAMIC_LIBRARY_FROM(Path...) {
  1896. PEERDIR($Path)
  1897. WHOLE_ARCHIVE($Path)
  1898. }
  1899. ### @usage: DLL(name major_ver [minor_ver] [EXPORTS symlist_file] [PREFIX prefix])
  1900. ###
  1901. ### Dynamic library module definition.
  1902. ### 1. major_ver and minor_ver must be integers.
  1903. ### 2. EXPORTS allows you to explicitly specify the list of exported functions. This accepts 2 kind of files: .exports with <lang symbol> pairs and JSON-line .symlist files
  1904. ### 3. PREFIX allows you to change the prefix of the output file (default DLL has the prefix "lib").
  1905. ###
  1906. ### DLL cannot participate in linking to programs but can be used from Java or as final artifact (packaged and deployed).
  1907. module DLL: DLL_UNIT {
  1908. .SEM=_CPP_DYN_LIBRARY_SEM
  1909. SET(MAKE_ONLY_SHARED_LIB yes)
  1910. when ($OS_WINDOWS) {
  1911. MODULE_SUFFIX=.dll
  1912. }
  1913. # TODO: Make it possible to use this syntax
  1914. # DEFAULT(DLL_FOR_DIR no)
  1915. ### FIXME: XXX
  1916. ###when ($DLL_FOR_DIR != "no") {
  1917. ### SRCDIR($DLL_FOR_DIR)
  1918. ### ADDINCL($DLL_FOR_DIR)
  1919. ###}
  1920. }
  1921. ### DLL_TOOL is a DLL that can be used as a LD_PRELOAD tool.
  1922. module DLL_TOOL: DLL {
  1923. .SEM=_CPP_DYN_LIBRARY_SEM
  1924. # ymake resolves only program nodes as tools.
  1925. .NODE_TYPE=Program
  1926. }
  1927. ### @usage: SO_PROGRAM(name major_ver [minor_ver] [EXPORTS symlist_file] [PREFIX prefix])
  1928. ###
  1929. ### Executable dynamic library module definition.
  1930. ### 1. major_ver and minor_ver must be integers.
  1931. ### 2. EXPORTS allows you to explicitly specify the list of exported functions. This accepts 2 kind of files: .exports with <lang symbol> pairs and JSON-line .symlist files
  1932. ### 3. PREFIX allows you to change the prefix of the output file.
  1933. module SO_PROGRAM: DLL {
  1934. .CMD=$LINK_EXEC_DYN_LIB
  1935. SET(MODULE_TYPE PROGRAM)
  1936. MODULE_PREFIX=
  1937. when ($MSVC == "yes" || $CYGWIN == "yes") {
  1938. MODULE_SUFFIX=.exe
  1939. }
  1940. otherwise {
  1941. MODULE_SUFFIX=
  1942. }
  1943. }
  1944. DLL_PROXY_CMD_MF=$GENERATE_MF && $COPY_CMD $AUTO_INPUT $TARGET
  1945. # tag:internal
  1946. ### @usage: DEV_DLL_PROXY() # internal
  1947. ###
  1948. ### The use of this module is strictly prohibited!!!
  1949. ### This is a temporary and project-specific solution.
  1950. module DEV_DLL_PROXY: _BARE_UNIT {
  1951. .NODE_TYPE=Library
  1952. .EXTS=.so .dll .dylib .mf
  1953. .CMD=DLL_PROXY_CMD_MF
  1954. DYNAMIC_LINK=yes
  1955. when ($OS_WINDOWS == "yes") {
  1956. MODULE_SUFFIX=.dll
  1957. }
  1958. elsewhen ($DARWIN == "yes" || $OS_IOS == "yes") {
  1959. MODULE_PREFIX=lib
  1960. MODULE_SUFFIX=.dylib$MODULE_VERSION
  1961. }
  1962. otherwise {
  1963. MODULE_PREFIX=lib
  1964. MODULE_SUFFIX=.so$MODULE_VERSION
  1965. }
  1966. }
  1967. # tag:internal
  1968. ### @usage: DYNAMIC_DEPS(Path...) # internal, temporary
  1969. ###
  1970. ### Enlist paths to all DYNAMIC_LIBRARY dependencies of the DYNAMIC_LIBRARY
  1971. ### This it needed to transfer their outputs through the library to PROGRAM
  1972. ### or dependent DLL/DYNAMIC_LIBRARY.
  1973. ###
  1974. ### Note: this is temporary solution until support of `super-global` variables come
  1975. ### which will enable transfer of some properties though final targets like DLLs.
  1976. macro DYNAMIC_DEPS(Path...) {
  1977. # PEERDIR as macro completely ignored in place where this macro applies
  1978. SET_APPEND(PEERDIR $Path)
  1979. }
  1980. # tag:internal
  1981. ### @usage: DYNAMIC_LIBRARY() # internal
  1982. ###
  1983. ### The use of this module is strictly prohibited except LGPL-related opensourcing
  1984. ### This provides linkable DLL module which brings its results to programs and tests
  1985. ### for seamless testing and packaging
  1986. multimodule DYNAMIC_LIBRARY {
  1987. module DLL_BIN: DLL {
  1988. .PROXY=yes
  1989. .IGNORED=PROVIDES
  1990. SET(MODULE_TAG DLL)
  1991. }
  1992. module DLL_LIB: _DLL_COMPATIBLE_LIBRARY {
  1993. .CMD=$TOUCH_UNIT_MF
  1994. .PEERDIRSELF=DLL_BIN
  1995. .IGNORED=SRCS PEERDIR RUN_PROGRAM PYTHON DYNAMIC_LIBRARY_FROM GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER USE_PYTHON2 USE_PYTHON3
  1996. .ALLOWED=DYNAMIC_DEPS
  1997. SET(PEERDIR_TAGS DLL_LIB __EMPTY__ RESOURCE_LIB)
  1998. _BARE_MODULE()
  1999. DYNAMIC_LINK=yes
  2000. MODULE_SUFFIX=.pkg.fake
  2001. PEERDIR+=build/platform/local_so
  2002. # disable credits generation for static library
  2003. SET(CREDITS_FLAGS)
  2004. }
  2005. }
  2006. ### @usage: GLOBAL_SRCS(filenames...)
  2007. ###
  2008. ### Make all source files listed as GLOBAL.
  2009. ### Call to GLOBAL_SRCS macro is equivalent to call to SRCS macro when each source file is marked with GLOBAL keyword.
  2010. ### Arcadia root relative or project dir relative paths are supported for filenames arguments. GLOBAL keyword is not
  2011. ### recognized for GLOBAL_SRCS in contrast to SRCS macro.
  2012. ###
  2013. ### @example:
  2014. ### Consider the file to ya.make:
  2015. ###
  2016. ### LIBRARY()
  2017. ### GLOBAL_SRCS(foo.cpp bar.cpp)
  2018. ### END()
  2019. ###
  2020. ### @see: [SRCS()](#macro_SRCS)
  2021. macro GLOBAL_SRCS(Files...) {
  2022. SRCS(${pre=GLOBAL :Files})
  2023. }
  2024. ### @usage: ALL_SRCS([GLOBAL] filenames...)
  2025. ###
  2026. ### Make all source files listed as GLOBAL or not depending on the keyword GLOBAL
  2027. ### Call to ALL_SRCS macro is equivalent to call to GLOBAL_SRCS macro when GLOBAL keyword is specified
  2028. ### as the first argument and is equivalent to call to SRCS macro otherwise.
  2029. ###
  2030. ### @example:
  2031. ###
  2032. ### LIBRARY()
  2033. ### SET(MAKE_IT_GLOBAL GLOBAL)
  2034. ### ALL_SRCS(${MAKE_IT_GLOBAL} foo.cpp bar.cpp)
  2035. ### END()
  2036. ###
  2037. ### @see: [GLOBAL_SRCS()](#macro_GLOBAL_SRCS), [SRCS()](#macro_SRCS)
  2038. macro ALL_SRCS(GLOBAL?"GLOBAL":"", Files...) {
  2039. SRCS(${pre=$GLOBAL :Files})
  2040. }
  2041. ### @usage: _DLL_COMPATIBLE_LIBRARY # internal
  2042. ###
  2043. ### Base module to place DLLs into multimodules back to back with libraries.
  2044. ### In order to function properly all modules in multimodule shall have the
  2045. ### same set of arguments. So this module is just library that accepts but
  2046. ### ignores all DLL arguments.
  2047. module _DLL_COMPATIBLE_LIBRARY: LIBRARY {
  2048. .DEFAULT_NAME_GENERATOR=TwoDirNames
  2049. .ARGS_PARSER=DLL
  2050. }
  2051. # as SRCS in packages use macro BUNDLE_SRCS!
  2052. PACKED_PACKAGE_ARGS=
  2053. PACKED_PACKAGE_EXT=
  2054. ### @usage: PACK(archive_type)
  2055. ###
  2056. ### When placed inside the PACKAGE module, packs the build results tree to the archive with specified extension. Currently supported extensions are `tar` and `tar.gz`
  2057. ###
  2058. ### Is not allowed other module types than PACKAGE().
  2059. ###
  2060. ### @see: [PACKAGE()](#module_PACKAGE)
  2061. macro PACK(Ext) {
  2062. SET(PACKED_PACKAGE_EXT $Ext)
  2063. }
  2064. ### @usage: PACKAGE(name)
  2065. ###
  2066. ### Module collects what is described directly inside it, builds and collects all its transitively available PEERDIRs.
  2067. ### As a result, build directory of the project gets the structure of the accessible part of Arcadia, where the build result of each PEERDIR is placed to relevant Arcadia subpath.
  2068. ### The data can be optionally packed if macro PACK() is used.
  2069. ###
  2070. ### Is only used together with the macros FILES(), PEERDIR(), COPY(), FROM_SANDBOX(), RUN_PROGRAM or BUNDLE(). Don't use SRCS inside a PACKAGE.
  2071. ###
  2072. ### Documentation: https://wiki.yandex-team.ru/yatool/large-data/
  2073. ###
  2074. ### @see: [PACK()](#macro_PACK)
  2075. multimodule PACKAGE {
  2076. module PACKAGE_FINAL: _BASE_UNIT {
  2077. .CMD=TOUCH_PACKAGE_MF
  2078. .ALIASES=SRCS=FILES
  2079. .ALLOWED=PACK
  2080. .PEERDIRSELF=PACKAGE_UNION
  2081. .USE_PEERS_LATE_OUTS=yes
  2082. .PEERDIR_POLICY=as_build_from
  2083. .FINAL_TARGET=yes
  2084. SET(PEERDIR_TAGS CPP_PROTO CPP_PROTO_FROM_SCHEMA CPP_FBS PY2 PY3 PY2_NATIVE PY3_NATIVE YQL_UDF_SHARED __EMPTY__ RESOURCE_LIB DOCSBOOK JAR_RUNNABLE PY3_BIN PY3TEST_PROGRAM DLL GO_PROGRAM TS PACKAGE_UNION)
  2085. SET(MODULE_SUFFIX .final.pkg.fake)
  2086. SET(DONT_RESOLVE_INCLUDES yes)
  2087. NO_PLATFORM()
  2088. when ($PACKED_PACKAGE_EXT) {
  2089. PACKED_PACKAGE_ARGS+=--dest-arch ${output;pre=$MODULE_PREFIX;suf=.$PACKED_PACKAGE_EXT:REALPRJNAME}
  2090. }
  2091. SET(NEED_PLATFORM_PEERDIRS no)
  2092. SET(_COPY_FILE_CONTEXT TEXT)
  2093. }
  2094. module PACKAGE_UNION: UNION {
  2095. .CMD=UNION_CMD
  2096. .FINAL_TARGET=no
  2097. .ALLOWED=PACK
  2098. .IGNORED=VCS_INFO_FILE
  2099. SET(MODULE_SUFFIX .pkg.fake)
  2100. SET(PEERDIR_TAGS CPP_PROTO CPP_PROTO_FROM_SCHEMA CPP_FBS PY2 PY3 PY2_NATIVE PY3_NATIVE YQL_UDF_SHARED __EMPTY__ RESOURCE_LIB DOCSBOOK JAR_RUNNABLE PY3_BIN PY3TEST_PROGRAM DLL GO_PROGRAM TS PACKAGE_UNION)
  2101. DISABLE(START_TARGET)
  2102. SET(_COPY_FILE_CONTEXT TEXT)
  2103. }
  2104. }
  2105. TOUCH_GROUP=$FAKE_PACKAGE_CMD $VCS_INFO_DISABLE_CACHE__NO_UID__ ${hide:PEERS} ${hide:AUTO_INPUT} ${hide:SRCS_GLOBAL} ${hide;kv:"p CI"} ${hide;kv:"package PACKAGE"}
  2106. ### @usage: CI_GROUP()
  2107. ###
  2108. ### Module collects what is described directly inside it transitively by PEERDIRs.
  2109. ### No particular layout of built artifacts is implied. This module is needed primarily for CI dependency analysis and may not trigger builds at all.
  2110. ###
  2111. ### Is only used together with the macro PEERDIR() and FILES(). Don't use SRCS inside CI_GROUP().
  2112. module CI_GROUP: _BARE_UNIT {
  2113. .CMD=TOUCH_GROUP
  2114. .PEERDIR_POLICY=as_build_from
  2115. .FINAL_TARGET=yes
  2116. .RESTRICTED=SRCS
  2117. .USE_PEERS_LATE_OUTS=yes
  2118. MODULE_SUFFIX=.ci.pkg.fake
  2119. PEERDIR_TAGS=CPP_PROTO CPP_PROTO_FROM_SCHEMA PY3 PY3_NATIVE PY3_BIN PY3TEST_PROGRAM YQL_UDF_SHARED __EMPTY__ RESOURCE_LIB DOCSBOOK JAR_RUNNABLE DLL PACKAGE_FINAL
  2120. }
  2121. # tag:generic tag:internal
  2122. TOUCH_UNIT_MF=$TOUCH_UNIT && $GENERATE_MF
  2123. ### @usage: UNION(name)
  2124. ###
  2125. ### Collection of PEERDIR dependencies, files and artifacts.
  2126. ### UNION doesn't build its peers, just provides those to modules depending on it.
  2127. ### When specified in DEPENDS() macro the UNION is transitively closed, building all its peers and providing those by own paths (without adding this module path like PACKAGE does).
  2128. ###
  2129. ### Is only used together with the macros like FILES(), PEERDIR(), COPY(), FROM_SANDBOX(), RUN_PROGRAM or BUNDLE(). Don't use SRCS inside a UNION.
  2130. ###
  2131. ### Documentation: https://wiki.yandex-team.ru/yatool/large-data/
  2132. module UNION: _BASE_UNIT {
  2133. .CMD=UNION_CMD_MF
  2134. .FINAL_TARGET=no
  2135. .ALIASES=SRCS=FILES
  2136. .ALLOWED=EXPLICIT_OUTPUTS
  2137. .IGNORED=VCS_INFO_FILE
  2138. NO_PLATFORM()
  2139. SET(MODULE_SUFFIX .pkg.fake)
  2140. SET(DONT_RESOLVE_INCLUDES yes)
  2141. SET(NEED_PLATFORM_PEERDIRS no)
  2142. PEERDIR_TAGS=CPP_PROTO CPP_PROTO_FROM_SCHEMA CPP_FBS PY2 PY2_NATIVE PY3_NATIVE YQL_UDF_SHARED __EMPTY__ RESOURCE_LIB DOCSBOOK JAR_RUNNABLE PY3_BIN DLL TS PACKAGE_UNION
  2143. UNION_OUTS=${hide;late_out:AUTO_INPUT}
  2144. when ($_UNION_EXPLICIT_OUTPUTS) {
  2145. UNION_OUTS=$_EXPAND_INS_OUTS($_UNION_EXPLICIT_OUTPUTS)
  2146. }
  2147. SET(_COPY_FILE_CONTEXT TEXT)
  2148. }
  2149. # tag:internal
  2150. ### @usage: _ADD_HIDDEN_INPUTS(inputs...) # internal
  2151. macro _ADD_HIDDEN_INPUTS(Inputs...) {
  2152. .CMD=${hide;input:Inputs}
  2153. }
  2154. # tag:internal
  2155. ### @usage: _SET_FIRST_VALUE(name args...) # internal
  2156. ###
  2157. ### This macro sets the value of `name` variable to the value of next argument
  2158. macro _SET_FIRST_VALUE(NAME, VALUE, OTHER...) {
  2159. SET($NAME $VALUE)
  2160. }
  2161. # tag:internal
  2162. ### @usage: _SRCS_NO_GLOBAL(files...) # internal
  2163. ###
  2164. ### Proxy macro to SRCS macro which filters out GLOBAL keyword from the list of source files.
  2165. ### Useful for modules like EXTERNAL_JAVA_LIBRARY, where GLOBAL keyword cannot be applied properly.
  2166. ### Note: this macro changes order of source files.
  2167. macro _SRCS_NO_GLOBAL(GLOBAL[], FILES...) {
  2168. SRCS($GLOBAL $FILES)
  2169. }
  2170. @import "${CONF_ROOT}/conf/java.conf"
  2171. @import "${CONF_ROOT}/conf/python.conf"
  2172. TEST_CWD_VALUE=
  2173. ### @usage: TEST_CWD(path)
  2174. ###
  2175. ### Defines working directory for test runs. Often used in conjunction with DATA() macro.
  2176. ### Is only used inside of the TEST modules.
  2177. ###
  2178. ### Documentation: https://wiki.yandex-team.ru/yatool/test/
  2179. macro TEST_CWD(Arg) {
  2180. SET(TEST_CWD_VALUE $Arg)
  2181. }
  2182. # tag:allocator
  2183. ### @usage: ALLOCATOR(Alloc) # Default: LF
  2184. ###
  2185. ### Set memory allocator implementation for the PROGRAM()/DLL() module.
  2186. ### This may only be specified for programs and dlls, use in other modules leads to configuration errors.
  2187. ###
  2188. ### Available allocators are: "LF", "LF_YT", "LF_DBG", "YT", "J", "B", "BM", "C", "TCMALLOC", "GOOGLE", "LOCKLESS", "SYSTEM", "FAKE", "MIM", "MIM_SDC", "HU", "PROFILED_HU", "THREAD_PROFILED_HU".
  2189. ### - LF - lfalloc (https://a.yandex-team.ru/arc/trunk/arcadia/library/cpp/lfalloc)
  2190. ### - LF_YT - Allocator selection for YT (https://a.yandex-team.ru/arc/trunk/arcadia/library/cpp/lfalloc/yt/ya.make)
  2191. ### - LF_DBG - Debug allocator selection (https://a.yandex-team.ru/arc/trunk/arcadia/library/cpp/lfalloc/dbg/ya.make)
  2192. ### - YT - The YTAlloc allocator (https://a.yandex-team.ru/arc/trunk/arcadia/library/cpp/ytalloc/impl/ya.make)
  2193. ### - J - The JEMalloc allocator (https://a.yandex-team.ru/arc/trunk/arcadia/library/malloc/jemalloc)
  2194. ### - B - The balloc allocator named Pyotr Popov and Anton Samokhvalov
  2195. ### - Discussion: https://ironpeter.at.yandex-team.ru/replies.xml?item_no=126
  2196. ### - Code: https://a.yandex-team.ru/arc/trunk/arcadia/library/cpp/balloc
  2197. ### - BM - The balloc for market (agri@ commits from july 2018 till November 2018 saved)
  2198. ### - C - Like B, but can be disabled for each thread to LF or SYSTEM one (B can be disabled only to SYSTEM)
  2199. ### - MIM - Microsoft's mimalloc (actual version) (https://a.yandex-team.ru/arc/trunk/arcadia/library/malloc/mimalloc)
  2200. ### - MIM_SDC - Microsoft's mimalloc patched by SDC (https://a.yandex-team.ru/arc/trunk/arcadia/library/malloc/mimalloc_sdc)
  2201. ### - TCMALLOC - Google TCMalloc (actual version) (https://a.yandex-team.ru/arc/trunk/arcadia/library/malloc/tcmalloc)
  2202. ### - GOOGLE - Google TCMalloc (https://a.yandex-team.ru/arc/trunk/arcadia/library/malloc/galloc)
  2203. ### - LOCKLESS - Allocator based upon lockless queues (https://a.yandex-team.ru/arc/trunk/arcadia/library/malloc/lockless)
  2204. ### - SYSTEM - Use target system allocator
  2205. ### - FAKE - Don't link with any allocator
  2206. ### - HU - Huge page allocator by @gulin.
  2207. ### - PROFILED_HU - patched HU. It is a bit slower but has metrics of memory consumption.
  2208. ### - THREAD_PROFILED_HU - patched (special for market) HU. It is a bit slower but has metrics of memory consumption.
  2209. ###
  2210. ### More about allocators in Arcadia: https://wiki.yandex-team.ru/arcadia/allocators/
  2211. macro ALLOCATOR(Alloc) {
  2212. SET(ALLOCATOR $Alloc)
  2213. when ($ALLOCATOR in [ "LF", "LF_YT", "LF_DBG", "YT", "YT_TCMALLOC", "YT_TCMALLOC_256K", "J", "B", "BM", "C", "TCMALLOC", "TCMALLOC_SMALL_BUT_SLOW", "TCMALLOC_NUMA_256K", "TCMALLOC_NUMA_LARGE_PAGES", "TCMALLOC_256K", "TCMALLOC_TC", "GOOGLE", "LOCKLESS", "SYSTEM", "FAKE", "MIM", "MIM_SDC", "HU", "PROFILED_HU", "THREAD_PROFILED_HU" ]) {
  2214. }
  2215. otherwise {
  2216. PEERDIR+=___configure_error___unknown_allocator_type___$ALLOCATOR
  2217. }
  2218. }
  2219. when ($MIC_ARCH == "yes") {
  2220. CFLAGS+=-mmic
  2221. LDFLAGS+=-mmic
  2222. }
  2223. when ($USE_OPENMP == "yes") {
  2224. PEERDIR+=contrib/libs/openmp
  2225. }
  2226. when ($STRIP == "yes" && $NO_STRIP != "yes") {
  2227. STRIP_FLAG=$LD_STRIP_FLAG
  2228. DWARF_COMMAND=
  2229. GO_LINK_FLAGS_VALUE+=-s
  2230. }
  2231. when ($NO_LINKER_DCE != "yes") {
  2232. DCE_FLAG=$LD_DCE_FLAG
  2233. }
  2234. when ($BT_MINSIZEREL == "yes" || $LINKER_ICF == "yes") {
  2235. ICF_FLAG=$LD_ICF_FLAG
  2236. }
  2237. OBJCOPY_TOOL=$OBJCOPY_TOOL_VENDOR
  2238. OBJDUMP_TOOL=$OBJDUMP_TOOL_VENDOR
  2239. STRIP_TOOL=$STRIP_TOOL_VENDOR
  2240. NM_TOOL=$NM_TOOL_VENDOR
  2241. NEED_LLVM_TOOLS_PEERDIR=
  2242. LLVM_TOOLS_ROOT=
  2243. when (!$OBJCOPY_TOOL_VENDOR) {
  2244. OBJCOPY_TOOL=${LLVM_TOOLS_ROOT}/bin/llvm-objcopy
  2245. NEED_LLVM_TOOLS_PEERDIR=yes
  2246. }
  2247. when (!$OBJDUMP_TOOL_VENDOR) {
  2248. OBJDUMP_TOOL=${LLVM_TOOLS_ROOT}/bin/llvm-objdump
  2249. NEED_LLVM_TOOLS_PEERDIR=yes
  2250. }
  2251. when (!$STRIP_TOOL_VENDOR) {
  2252. STRIP_TOOL=${LLVM_TOOLS_ROOT}/bin/llvm-strip
  2253. NEED_LLVM_TOOLS_PEERDIR=yes
  2254. }
  2255. when (!$NM_TOOL_VENDOR) {
  2256. NM_TOOL=${LLVM_TOOLS_ROOT}/bin/llvm-nm
  2257. NEED_LLVM_TOOLS_PEERDIR=yes
  2258. }
  2259. SPLIT_DWARF_VALUE=no
  2260. NO_SPLIT_DWARF=no
  2261. when ($OS_DARWIN || $OS_IOS || $OS_IOSSIM) {
  2262. SPLIT_DWARF_VALUE=yes
  2263. }
  2264. when ($STRIP_DEBUG_INFO) {
  2265. SPLIT_DWARF_VALUE=yes
  2266. NO_SPLIT_DWARF=no
  2267. }
  2268. ### @usage: SPLIT_DWARF()
  2269. ###
  2270. ### Emit debug info for the PROGRAM/DLL as a separate file <module_name>.debug.
  2271. ### NB: It does not help you to save process RSS but can add problems (see e.g. BEGEMOT-2147).
  2272. macro SPLIT_DWARF() {
  2273. SET(SPLIT_DWARF_VALUE yes)
  2274. }
  2275. ### @usage: NO_SPLIT_DWARF()
  2276. ###
  2277. ### Do NOT emit debug info for the PROGRAM/DLL as a separate file.
  2278. ### On macOS this also means do NOT generate dSym files (faster linkage)
  2279. macro NO_SPLIT_DWARF() {
  2280. SET(SPLIT_DWARF_VALUE no)
  2281. }
  2282. SPLIT_DWARF_OUTPUT=${tobindir;output;pre=$MODULE_PREFIX;suf=$MODULE_SUFFIX.debug:REALPRJNAME}
  2283. when ($SPLIT_DWARF_VALUE == "yes" && $NO_SPLIT_DWARF != "yes" && $NO_DEBUGINFO != "yes" && $HOST_OS_LINUX == "yes" && $TARGET_PLATFORM == "LINUX") {
  2284. DWARF_COMMAND= \
  2285. $OBJCOPY_TOOL --only-keep-debug $TARGET $SPLIT_DWARF_OUTPUT && \
  2286. $STRIP_TOOL --strip-debug $TARGET && \
  2287. $OBJCOPY_TOOL --remove-section=.gnu_debuglink --add-gnu-debuglink $SPLIT_DWARF_OUTPUT $TARGET
  2288. }
  2289. ### @usage: EXTRALIBS_STATIC(Libs...)
  2290. ###
  2291. ### Add the specified external static libraries to the program link
  2292. macro EXTRALIBS_STATIC(Args...) {
  2293. LDFLAGS(-Wl,-Bstatic ${Args} -Wl,-Bdynamic)
  2294. }
  2295. ### @usage: ADD_COMPILABLE_TRANSLATE(Dict Name Options...)
  2296. ###
  2297. ### Generate translation dictionary code to transdict.LOWER(Name).cpp that will than be compiled into library
  2298. macro ADD_COMPILABLE_TRANSLATE(Dict, Name, MakeTransDictOptions...) {
  2299. __translatename_lower=${tolower:Name}
  2300. __translate_dict=${BINDIR}/transdict.${__translatename_lower}.cpp
  2301. RUN_PROGRAM(dict/tools/maketransdict -i ${Dict} ${MakeTransDictOptions} ${Name} STDOUT_NOAUTO ${__translate_dict} IN ${Dict})
  2302. }
  2303. ### @usage: ADD_COMPILABLE_TRANSLIT(TranslitTable NGrams Name Options...)
  2304. ###
  2305. ### Generate transliteration dictionary code
  2306. ### This will emit both translit, untranslit and ngrams table codes those will be than further compiled into library
  2307. macro ADD_COMPILABLE_TRANSLIT(TranslitTable, NGrams, Name, Options...) {
  2308. __translitname_lower=${tolower:Name}
  2309. __translit_table=${BINDIR}/translit_trie_${__translitname_lower}.cpp
  2310. __untranslit_table=${BINDIR}/untranslit_trie_${__translitname_lower}.cpp
  2311. __ngrams_table=${BINDIR}/ngr_arr_${__translitname_lower}.cpp
  2312. __gentrie_dir=dict/tools/make_untranslit_trie
  2313. RUN_PROGRAM(${__gentrie_dir} -i ${TranslitTable} ${Options} ${__translitname_lower} IN ${TranslitTable} STDOUT ${__untranslit_table})
  2314. RUN_PROGRAM(${__gentrie_dir} -i ${TranslitTable} -n ${Options} ${__translitname_lower} IN ${TranslitTable} STDOUT ${__translit_table})
  2315. RUN_PROGRAM(dict/tools/make_ngrams -i ${NGrams} ${Options} ${__translitname_lower} IN ${NGrams} STDOUT ${__ngrams_table})
  2316. }
  2317. _COPY_FILE_CONTEXT=TEXT
  2318. macro _COPY_FILE_IMPL(TEXT[], AUTO_DST="", NOAUTO_DST="", OUTPUT_INCLUDES[], INDUCED_DEPS[], OUTPUT_INCLUDES_INP[], FILE...) {
  2319. .CMD=$COPY_CMD ${input:FILE} ${context=TEXT;input:TEXT} ${output:AUTO_DST} ${noauto;output:NOAUTO_DST} ${hide;output_include:OUTPUT_INCLUDES} ${output_include;from_input;hide:OUTPUT_INCLUDES_INP} $INDUCED_DEPS ${hide;kv:"p CP"} ${hide;kv:"pc light-cyan"}
  2320. .SEM=target_commands-ITEM && target_commands-macro copy_file && target_commands-args ${input:FILE} ${output:AUTO_DST} ${noauto;output:NOAUTO_DST}
  2321. }
  2322. ### @usage: COPY_FILE(File Destination [AUTO] [OUTPUT_INCLUDES Deps...])
  2323. ###
  2324. ### Copy file to build root. It is possible to change both location and the name.
  2325. ###
  2326. ### Parameters:
  2327. ### - File - Source file name.
  2328. ### - Destination - Output file name.
  2329. ### - AUTO - Consider copied file for further processing automatically.
  2330. ### - OUTPUT_INCLUDES output_includes... - Output file dependencies.
  2331. ### - INDUCED_DEPS $VARs... - Dependencies for generated files. Unlike `OUTPUT_INCLUDES` these may target files further in processing chain.
  2332. ### In order to do so VAR should be filled by PREPARE_INDUCED_DEPS macro, stating target files (by type)
  2333. ### and set of dependencies
  2334. ###
  2335. ### The file will be just copied if AUTO boolean parameter is not specified. You should explicitly
  2336. ### mention it in SRCS under new name (or specify AUTO boolean parameter) for further processing.
  2337. macro COPY_FILE(File, Destination, AUTO?"AUTO_DST":"NOAUTO_DST", OUTPUT_INCLUDES[], INDUCED_DEPS[], TEXT?"TEXT":"$_COPY_FILE_CONTEXT") {
  2338. .CMD=$_COPY_FILE_IMPL($TEXT $File $AUTO $Destination OUTPUT_INCLUDES $OUTPUT_INCLUDES INDUCED_DEPS $INDUCED_DEPS)
  2339. .SEM=$_COPY_FILE_IMPL($File $AUTO $Destination)
  2340. }
  2341. ### @usage: COPY_FILE_WITH_CONTEXT(FILE DEST [AUTO] [OUTPUT_INCLUDES DEPS...])
  2342. ###
  2343. ### Copy file to build root the same way as it is done for COPY_FILE, but also
  2344. ### propagates the context of the source file.
  2345. macro COPY_FILE_WITH_CONTEXT(FILE, DEST, AUTO?"AUTO_DST":"NOAUTO_DST", OUTPUT_INCLUDES[], INDUCED_DEPS[]) {
  2346. .CMD=$_COPY_FILE_IMPL($FILE $AUTO $DEST OUTPUT_INCLUDES_INP $FILE OUTPUT_INCLUDES $OUTPUT_INCLUDES INDUCED_DEPS $INDUCED_DEPS)
  2347. }
  2348. ### This is to join $ALL_RES_ and $EXT
  2349. macro _ARF_HELPER(Args...) {
  2350. RESOURCE_FILES($Args)
  2351. }
  2352. ### @usage: ALL_RESOURCE_FILES(Ext [PREFIX {prefix}] [STRIP {strip}] Dirs...)
  2353. ###
  2354. ### This macro collects all files with extension `Ext` and
  2355. ### Passes them to `RESOURCE_FILES` macro as relative to current directory
  2356. ###
  2357. ### `PREFIX` and `STRIP` have the same meaning as in `ROURCES_FILES`, both are applied over moddir-relative paths
  2358. ###
  2359. ### Note: This macro can be used multiple times per ya.make, but only once for each Ext value
  2360. ### Note: Wildcards are not allowed neither as Ext nor in Dirs
  2361. macro ALL_RESOURCE_FILES(EXT, PREFIX="", STRIP="", DIRS...) {
  2362. _GLOB(ALL_RES_$EXT ${suf=/*.$EXT:DIRS})
  2363. _ARF_HELPER(${pre=PREFIX :PREFIX} STRIP ${ARCADIA_ROOT}/${MODDIR}/${STRIP} ${pre=$ALL_RES_:EXT})
  2364. }
  2365. ### @usage: ALL_RESOURCE_FILES_FROM_DIRS([PREFIX {prefix}] [STRIP {strip}] Dirs...)
  2366. ###
  2367. ### This macro collects all files non-recursively from listed Dirs and
  2368. ### Passes them to `RESOURCE_FILES` macro as relative to current directory
  2369. ### The macro is usefull if literally all files are needed because `ALL_RESOURCE_FILES` requires extension to be specified
  2370. ###
  2371. ### `PREFIX` and `STRIP` have the same meaning as in `ROURCES_FILES`, both are applied over moddir-relative paths
  2372. ###
  2373. ### Note: This macro can be used only once per ya.make
  2374. ### Note: Wildcards are not allowed neither as Ext nor in Dirs
  2375. macro ALL_RESOURCE_FILES_FROM_DIRS(PREFIX="", STRIP="", DIRS...) {
  2376. _GLOB(_ALL_RES_DIRS ${suf=/*:DIRS})
  2377. _ARF_HELPER(${pre=PREFIX :PREFIX} STRIP ${ARCADIA_ROOT}/${MODDIR}/${STRIP} ${_ALL_RES_DIRS})
  2378. }
  2379. macro _BUNDLE_TARGET(Target, Destination, Suffix) {
  2380. .CMD=$MOVE_FILE ${result:Target}$Suffix ${noauto;output:Destination} ${hide;kv:"p BN"} ${hide;kv:"pc light-cyan"} $VCS_INFO_DISABLE_CACHE__NO_UID__
  2381. }
  2382. ### @usage: TIMEOUT(TIMEOUT)
  2383. ###
  2384. ### Sets a timeout on test execution
  2385. ###
  2386. ### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/
  2387. macro TIMEOUT(Time) {
  2388. SET(TEST_TIMEOUT $Time)
  2389. }
  2390. SBR_UID_EXT=""
  2391. # tag:test
  2392. ### @usage: VALIDATE_DATA_RESTART(ext)
  2393. ###
  2394. ### Change uid for resource validation tests. May be useful when sandbox resource ttl is changed, but test status is cached in CI.
  2395. ### You can change ext to change test's uid. For example VALIDATE_DATA_RESTART(X), where is X is current revision.
  2396. macro VALIDATE_DATA_RESTART(Ext) {
  2397. SET(SBR_UID_EXT $Ext)
  2398. }
  2399. # tag:test
  2400. TEST_FORK_MODE=none
  2401. TEST_PARTITION=SEQUENTIAL
  2402. # tag:test
  2403. ### @usage: FORK_TESTS()
  2404. ###
  2405. ### Splits a test run on chunks by test classes.
  2406. ### The number of chunks can be overridden using the macro SPLIT_FACTOR.
  2407. ###
  2408. ### Allows to run tests in parallel. Supported in UNITTEST, JTEST/JUNIT5 and PY2TEST/PY3TEST modules.
  2409. ###
  2410. ### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/
  2411. macro FORK_TESTS(MODE...) {
  2412. SET(TEST_FORK_MODE tests)
  2413. SET(TEST_PARTITION $MODE)
  2414. }
  2415. # tag:test
  2416. ### @usage: FORK_SUBTESTS()
  2417. ###
  2418. ### Splits the test run in chunks on subtests.
  2419. ### The number of chunks can be overridden using the macro SPLIT_FACTOR.
  2420. ###
  2421. ### Allows to run tests in parallel. Supported in UNITTEST, JTEST/JUNIT5 and PY2TEST/PY3TEST modules.
  2422. ###
  2423. ### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/
  2424. macro FORK_SUBTESTS(MODE...) {
  2425. SET(TEST_FORK_MODE subtests)
  2426. SET(TEST_PARTITION $MODE)
  2427. }
  2428. # tag:test
  2429. ### @usage: SPLIT_FACTOR(x)
  2430. ###
  2431. ### Sets the number of chunks for parallel run tests when used in test module with FORK_TESTS() or FORK_SUBTESTS().
  2432. ### If none of those is specified this macro implies FORK_TESTS().
  2433. ###
  2434. ### Supports C++ ut and PyTest.
  2435. ###
  2436. ### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/
  2437. macro SPLIT_FACTOR(Factor) {
  2438. SET(TEST_SPLIT_FACTOR $Factor)
  2439. }
  2440. # tag:test
  2441. FORK_TEST_FILES_MODE=
  2442. ### @usage: FORK_TEST_FILES()
  2443. ###
  2444. ### Only for PY2TEST and PY3TEST: splits a file executable with the tests on chunks in the files listed in TEST_SRCS
  2445. ### Compatible with FORK_(SUB)TESTS.
  2446. ###
  2447. ### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/
  2448. macro FORK_TEST_FILES() {
  2449. SET(FORK_TEST_FILES_MODE on)
  2450. }
  2451. # tag:test
  2452. TEST_SIZE_NAME=SMALL
  2453. ### @usage: SIZE(SMALL/MEDIUM/LARGE)
  2454. ###
  2455. ### Set the 'size' for the test. Each 'size' has own set of resrtictions, SMALL bein the most restricted and LARGE being the list.
  2456. ### See documentation on test system for more details.
  2457. ###
  2458. ### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/
  2459. macro SIZE(Type) {
  2460. SET(TEST_SIZE_NAME $Type)
  2461. }
  2462. ### @usage: JOIN_SRCS(Out Src...)
  2463. ###
  2464. ### Join set of sources into single file named Out and send it for further processing.
  2465. ### This macro doesn't place all file into Out, it emits #include<Src>... Use the for C++ source files only.
  2466. ### You should specify file name with the extension as Out. Further processing will be done according this extension.
  2467. macro JOIN_SRCS(Out, Src...) {
  2468. .CMD=$YMAKE_PYTHON3 ${input:"build/scripts/gen_join_srcs.py"} ${hide;input:"build/scripts/process_command_files.py"} ${output:Out} --ya-start-command-file ${context=TEXT;input;rootrel:Src} --ya-end-command-file ${output_include;from_input;hide:Src} ${hide;kv:"p JS"} ${hide;kv:"pc magenta"}
  2469. .SEM=target_macroses-ITEM && target_macroses-macro target_joined_source && target_macroses-args $Out ${input:Src} ${hide;output;suf=.o:Out} ${hide;input:"build/scripts/gen_join_srcs.py"} ${hide;input:"build/scripts/process_command_files.py"}
  2470. _CONDITIONAL_SRCS($TIDY_VALUE $Src)
  2471. }
  2472. ### @usage: JOIN_SRCS_GLOBAL(Out Src...)
  2473. ###
  2474. ### Join set of sources into single file named Out and send it for further processing as if it were listed as SRCS(GLOBAL Out).
  2475. ### This macro doesn't place all file into Out, it emits #include<Src>... Use the for C++ source files only.
  2476. ### You should specify file name with the extension as Out. Further processing will be done according to this extension.
  2477. macro JOIN_SRCS_GLOBAL(Out, Src...) {
  2478. .CMD=$YMAKE_PYTHON3 ${input:"build/scripts/gen_join_srcs.py"} ${hide;input:"build/scripts/process_command_files.py"} ${noauto;output:Out} --ya-start-command-file ${input;rootrel;context=TEXT:Src} --ya-end-command-file ${output_include;from_input;hide:Src} ${hide;kv:"p JS"} ${hide;kv:"pc magenta"}
  2479. SRCS(GLOBAL $Out)
  2480. }
  2481. ### @usage: FLAT_JOIN_SRCS_GLOBAL(Out Src...)
  2482. ###
  2483. ### Join set of sources into single file named Out and send it for further processing as if it were listed as SRCS(GLOBAL Out).
  2484. ### This macro places all files into single file, so will work with any sources.
  2485. ### You should specify file name with the extension as Out. Further processing will be done according to this extension.
  2486. macro FLAT_JOIN_SRCS_GLOBAL(Out, Src...) {
  2487. .CMD=$FS_TOOLS cat ${noauto;output:Out} --ya-start-command-file ${context=TEXT;input:Src} --ya-end-command-file ${output_include;from_input;hide:Src} ${hide;kv:"p JS"} ${hide;kv:"pc magenta"}
  2488. SRCS(GLOBAL $Out)
  2489. }
  2490. # tag:cpu
  2491. PIC_CFLAGS=
  2492. SSE2_CFLAGS=
  2493. SSE3_CFLAGS=
  2494. SSSE3_CFLAGS=
  2495. SSE41_CFLAGS=
  2496. SSE42_CFLAGS=
  2497. POPCNT_CFLAGS=
  2498. PCLMUL_CFLAGS=
  2499. CX16_FLAGS=
  2500. AVX_CFLAGS=
  2501. AVX2_CFLAGS=
  2502. AVX512_CFLAGS=
  2503. AMX_CFLAGS=
  2504. # tag:cpu
  2505. SSE_DEFINES=
  2506. SSE_CFLAGS=
  2507. SSE4_DEFINES=
  2508. SSE4_CFLAGS=
  2509. XOP_CFLAGS=
  2510. NO_LTO_CFLAGS=
  2511. # tag:cpu
  2512. when (($ARCH_X86_64 || $ARCH_I386) && $DISABLE_INSTRUCTION_SETS != "yes") {
  2513. when ($CLANG || $CLANG_CL || $GCC) {
  2514. PIC_CFLAGS=-fPIC
  2515. SSE2_CFLAGS=-msse2
  2516. SSE3_CFLAGS=-msse3
  2517. SSSE3_CFLAGS=-mssse3
  2518. SSE41_CFLAGS=-msse4.1
  2519. SSE42_CFLAGS=-msse4.2
  2520. XOP_CFLAGS=-mxop
  2521. POPCNT_CFLAGS=-mpopcnt
  2522. PCLMUL_CFLAGS=-mpclmul
  2523. AVX_CFLAGS=-mavx
  2524. # On Intel BMI1, BMI2 and FMA3 instruction sets come together with AVX-2 extension starting with Broadwell / Haswell.
  2525. # See:
  2526. # https://en.wikipedia.org/wiki/FMA_instruction_set
  2527. # https://en.wikipedia.org/wiki/X86_Bit_manipulation_instruction_set
  2528. #
  2529. # AMD implemented FMA3 in Piledriver architecture over AVX (that is, prior to AVX-2 which was introduced in Zen).
  2530. # BMI2 implementation was released by AMD along with AVX-2 support.
  2531. # See:
  2532. # https://en.wikipedia.org/wiki/Template:AMD_x86_CPU_features
  2533. #
  2534. # Due to the above, it looks safe to enable all three extensions whenever AVX-2 is enabled.
  2535. AVX2_CFLAGS=-mavx2 -mfma -mbmi -mbmi2
  2536. # All Intel CPUS with AVX-512 have these instructions except for the Knights Landing / Knights Mill
  2537. # (these are Xeon Phi)
  2538. # See:
  2539. # https://en.wikichip.org/wiki/x86/avx-512
  2540. AVX512_CFLAGS=-mavx512f -mavx512cd -mavx512bw -mavx512dq -mavx512vl
  2541. # AMX stands Advanced Matrix Extension supported by modern Intel architectures
  2542. # See:
  2543. # https://en.wikipedia.org/wiki/Advanced_Matrix_Extensions
  2544. # https://en.wikichip.org/wiki/x86/amx
  2545. AMX_CFLAGS=-mamx-tile -mamx-int8 ${AVX512_CFLAGS}
  2546. when ($ARCH_X86_64 && $OS_ANDROID != "yes") {
  2547. CX16_FLAGS=-mcx16
  2548. }
  2549. SSE_DEFINES=-DSSE_ENABLED=1 -DSSE3_ENABLED=1 -DSSSE3_ENABLED=1
  2550. SSE4_DEFINES=-DSSE41_ENABLED=1 -DSSE42_ENABLED=1 -DPOPCNT_ENABLED=1 -DCX16_ENABLED=1
  2551. }
  2552. elsewhen ($MSVC) {
  2553. SSE2_CFLAGS=/D__SSE2__=1
  2554. SSE3_CFLAGS=/D__SSE3__=1
  2555. SSSE3_CFLAGS=/D__SSSE3__=1
  2556. SSE41_CFLAGS=/D__SSE4_1__=1
  2557. SSE42_CFLAGS=/D__SSE4_2__=1
  2558. POPCNT_CFLAGS=/D__POPCNT__=1
  2559. PCLMUL_CFLAGS=/D__PCLMUL__=1
  2560. AVX_CFLAGS=/arch:AVX /DAVX_ENABLED=1
  2561. AVX2_CFLAGS=/arch:AVX2 /DAVX2_ENABLED=1
  2562. AVX512_CFLAGS=/arch:AVX512 /DAVX512_ENABLED=1
  2563. SSE_DEFINES=/DSSE_ENABLED=1 /DSSE3_ENABLED=1 /DSSSE3_ENABLED=1
  2564. SSE4_DEFINES=/DSSE41_ENABLED=1 /DSSE42_ENABLED=1 /DPOPCNT_ENABLED=1 /DCX16_ENABLED=1
  2565. }
  2566. SSE_CFLAGS=$SSE2_CFLAGS $SSE3_CFLAGS $SSSE3_CFLAGS
  2567. SSE4_CFLAGS=$SSE41_CFLAGS $SSE42_CFLAGS $POPCNT_CFLAGS $CX16_FLAGS
  2568. when ($ARCH_I386 && $OS_ANDROID == "yes") {
  2569. USE_SSE4=no
  2570. }
  2571. }
  2572. otherwise {
  2573. USE_SSE4=no
  2574. CPU_CHECK=no
  2575. }
  2576. # tag:cpu
  2577. when ($NOSSE == "yes") {
  2578. USE_SSE4=no
  2579. }
  2580. # tag:cpu
  2581. ### @usage: NO_SSE4()
  2582. ###
  2583. ### Compile module without SSE4
  2584. macro NO_SSE4() {
  2585. SET(USE_SSE4 no)
  2586. }
  2587. # tag:cpu
  2588. ### @usage: NO_CPU_CHECK()
  2589. ###
  2590. ### Compile module without startup CPU features check
  2591. macro NO_CPU_CHECK() {
  2592. SET(CPU_CHECK no)
  2593. }
  2594. ### @usage: ADDINCLSELF()
  2595. ###
  2596. ### The macro adds the -I<project source path> flag to the source compilation flags of the current project.
  2597. macro ADDINCLSELF(FOR="") {
  2598. when($FOR) {
  2599. ADDINCL+=FOR $FOR ${MODDIR}
  2600. }
  2601. otherwise {
  2602. ADDINCL+=${MODDIR}
  2603. }
  2604. }
  2605. COMPILE_OUT_SUFFIX=
  2606. _COMPILE_OUTPUTS=${output;suf=${COMPILE_OUT_SUFFIX}${OBJECT_SUF}:SRC}
  2607. _COMPILE_TIME_TRACE_OUTPUTS=${noauto;output;suf=${COMPILE_OUT_SUFFIX}${OBJECT_SUF}.time_trace.json:SRC}
  2608. macro SET_COMPILE_OUTPUTS_MODIFIERS(NOREL?"norel;output":"output") {
  2609. SET(_COMPILE_OUTPUTS \${$NOREL;suf=\${OBJECT_SUF}:SRC})
  2610. SET(_COMPILE_TIME_TRACE_OUTPUTS \${noauto;$NOREL;suf=\${OBJECT_SUF}.time_trace.json:SRC})
  2611. }
  2612. ### @usage: _ADD_EXTRA_FLAGS_IMPL([GENERATE] Args...) # internal
  2613. ### Generate prefix with specific semantics before $Args when GENERATE
  2614. ### is specified in the list of actual arguments
  2615. macro _ADD_EXTRA_FLAGS_IMPL(GENERATE?" && target_commands-ITEM && target_commands-macro set_property && target_commands-args SOURCE ${input:SRC} APPEND PROPERTY COMPILE_OPTIONS ":"", Args...) {
  2616. .SEM=$GENERATE $Args
  2617. }
  2618. # tag:internal
  2619. ### @usage: _ADD_EXTRA_FLAGS([GENERATE] Args...) # internal
  2620. ### Generate prefix if Args is not empty
  2621. macro _ADD_EXTRA_FLAGS(COMPILE_OUT_SUFFIX="", Args...) {
  2622. .SEM=$_ADD_EXTRA_FLAGS_IMPL(${pre=GENERATE :Args})
  2623. }
  2624. _EMPTY_CMD=
  2625. # tag:src-processing
  2626. macro _SRC("swg", SRC, SRCFLAGS...) {
  2627. .CMD=${_SWIG_CMD}
  2628. .PEERDIR=${_SWIG_PEERDIR}
  2629. .SEM=conan-tool_requires swig/4.0.2 && conan-imports 'bin, *swig* -> ./bin' ${hide;input:SRC} ${_SWIG_SEM_TO_MODULE_LINK}
  2630. }
  2631. RODATA_SYMBOL_PREFIX=
  2632. when ($DARWIN == "yes" || $IOS == "yes" || ($WINDOWS == "yes" && $ARCH_TYPE_32 == "yes")) {
  2633. RODATA_SYMBOL_PREFIX=_
  2634. }
  2635. RODATA_ELF_FLAGS=
  2636. when($LINUX == "yes" || $ANDROID == "yes") {
  2637. RODATA_ELF_FLAGS=--elf
  2638. }
  2639. RODATA_COMPILE=$YMAKE_PYTHON3 ${input:"build/scripts/rodata2asm.py"} $RODATA_ELF_FLAGS ${RODATA_SYMBOL_PREFIX}${noext;nopath:SRC} ${input:SRC} ${tmp;suf=.asm:SRC} ${hide:OBJECT_SUF} && $_SRC_yasm_helper(${tmp;suf=.asm:SRC})
  2640. when (($ARCH_AARCH64 || $ARCH_ARM || $ARCH_PPC64LE || $ARCH_RISCV32) == "yes") {
  2641. RODATA_COMPILE=$YMAKE_PYTHON3 ${input:"build/scripts/rodata2cpp.py"} ${noext;nopath:SRC} ${input:SRC} ${output;suf=.cpp:SRC}
  2642. }
  2643. # tag:src-processing
  2644. macro _SRC("rodata", SRC, SRCFLAGS...) {
  2645. .CMD=$RODATA_COMPILE ${hide;kv:"p RD"} ${hide;kv:"pc light-green"}
  2646. .SEM=target_macroses-ITEM && target_macroses-macro target_rodata_sources && target_macroses-args PRIVATE ${input:SRC} ${hide;output;suf=${OBJ_SUF}.o:SRC} ${hide;input:"build/scripts/rodata2cpp.py"}
  2647. }
  2648. macro _SRC_S_ASM(SRC, SRCFLAGS...) {
  2649. .CMD=$C_COMPILER $C_FLAGS_PLATFORM $CFLAGS $SFLAGS $SRCFLAGS -c -o ${output;suf=.o:SRC} ${input:SRC} $TOOLCHAIN_ENV ${pre=-I:_C__INCLUDE} ${hide;kv:"p AS"} ${hide;kv:"pc light-green"}
  2650. .SEM=target_options-privates-ITEM && target_options-privates-option target_sources && target_options-privates-args ${input:SRC} ${hide;output;suf=${OBJ_SUF}.o:SRC} && project_languages ASM
  2651. }
  2652. # tag:src-processing
  2653. macro _SRC("S", SRC, SRCFLAGS...) {
  2654. .CMD=$_SRC_S_ASM($SRC $SRCFLAGS)
  2655. .SEM=$_SRC_S_ASM($SRC, $SRCFLAGS)
  2656. .STRUCT_CMD=yes
  2657. }
  2658. # tag:src-processing
  2659. macro _SRC("s", SRC, SRCFLAGS...) {
  2660. .CMD=$_SRC_S_ASM($SRC $SRCFLAGS)
  2661. .SEM=$_SRC_S_ASM($SRC, $SRCFLAGS)
  2662. .STRUCT_CMD=yes
  2663. }
  2664. # tag:src-processing
  2665. macro _SRC("s79", SRC, SRCFLAGS...) {
  2666. .CMD=$_SRC(S, $SRC $SRCFLAGS -x assembler-with-cpp)
  2667. }
  2668. # tag:src-processing
  2669. macro _SRC("mm", SRC, SRCFLAGS...) {
  2670. .CMD=$C_COMPILER $C_FLAGS_PLATFORM -x objective-c++ -fobjc-arc -fobjc-abi-version=2 -c -o ${output;suf=.o:SRC} ${input:SRC} $CXXFLAGS ${pre=-I:_C__INCLUDE} ${SRCFLAGS} ${hide;kv:"p CC"} ${hide;kv:"pc light-green"} $TOOLCHAIN_ENV
  2671. .STRUCT_CMD=yes
  2672. }
  2673. # tag:src-processing
  2674. macro _SRC("sfdl", SRC, SRCFLAGS...) {
  2675. .CMD=$CXX_COMPILER $C_FLAGS_PLATFORM $CXXFLAGS $SFDL_FLAG ${SRCFLAGS} ${input:SRC} && ${tool:"tools/calcstaticopt"} -i ${tmp;suf=.tmp:SRC} -a $ARCADIA_ROOT ${stdout;output;defext=.inc;nopath;noext:SRC} ${hide;kv:"p SF"} ${hide;kv:"pc yellow"} $TOOLCHAIN_ENV
  2676. .STRUCT_CMD=yes
  2677. }
  2678. macro _XS_SRCS(SRC, TYPEMAPS[], SRCFLAGS...) {
  2679. .CMD=$PERL_LD_LIBRARY_PATH $PERL $PERL_INCLUDE ${suf=/ExtUtils/xsubpp:PERL_PRIVLIB} -typemap ${suf=/ExtUtils/typemap:PERL_PRIVLIB} $PERLSUFFIX $XSUBPPFLAGS ${pre=-typemap :TYPEMAPS} ${hide;input:TYPEMAPS} ${SRCFLAGS} ${input:SRC} ${PERLOUTPUT} ${hide;kv:"p XS"} ${hide;kv:"pc yellow"}
  2680. }
  2681. # tag:src-processing
  2682. macro _SRC("xs", SRC, SRCFLAGS...) {
  2683. .CMD=$_XS_SRCS($SRC TYPEMAPS $_XSTYPEMAPS $SRCFLAGS)
  2684. }
  2685. # tag:src-processing
  2686. macro _SRC("gperf", SRC, SRCFLAGS...) {
  2687. .CMD=$RUN_NO_SANITIZE ${tool:"contrib/tools/gperf"} $GP_FLAGS ${SRCFLAGS} ${pre=-Nin_;suf=_set;nopath;noallext:SRC} ${input:SRC} ${stdout;output;nopath;noext;defext=.gperf.cpp:SRC} ${hide;kv:"p GP"} ${hide;kv:"pc yellow"}
  2688. }
  2689. # tag:src-processing
  2690. macro _SRC("rl", SRC, SRCFLAGS...) {
  2691. .CMD=$RUN_NO_SANITIZE ${tool:"contrib/tools/ragel5/ragel"} $RAGEL_FLAGS ${SRCFLAGS} -o ${tmp:SRC.tmp} ${input:SRC} && $RUN_NO_SANITIZE ${tool:"contrib/tools/ragel5/rlgen-cd"} $RLGEN_FLAGS -o ${output;nopath;noext;defext=.rl5.cpp:SRC} ${tmp:SRC.tmp} ${hide;kv:"p R5"} ${hide;kv:"pc yellow"}
  2692. }
  2693. macro _SRC("xsyn", SRC, SRCFLAGS...) {
  2694. .CMD=$YMAKE_PYTHON ${input:"library/cpp/xml/parslib/xsyn2ragel.py"} ${input:SRC} ${input:"library/cpp/xml/parslib/xmlpars.xh"} dontuse ${stdout;output;suf=.h.rl5:SRC} ${hide;kv:"p XN"} ${hide;kv:"pc yellow"}
  2695. }
  2696. # tag:src-processing
  2697. macro _SRC("rl5", SRC, SRCFLAGS...) {
  2698. .CMD=$_SRC(rl $SRC $SRCFLAGS)
  2699. }
  2700. # tag:src-processing
  2701. macro _SRC("asp", SRC, SRCFLAGS...) {
  2702. .CMD=$RUN_NO_SANITIZE ${tool:"tools/html2cpp"} ${input:SRC} ${output:SRC.cpp} ${hide;kv:"p HT"} ${hide;kv:"pc yellow"}
  2703. }
  2704. # tag:src-processing
  2705. macro _SRC("rl6", SRC, SRCFLAGS...) {
  2706. .CMD=$RUN_NO_SANITIZE ${tool:"contrib/tools/ragel6"} $RAGEL6_FLAGS ${SRCFLAGS} -L -I${ARCADIA_ROOT} -o ${output;nopath;noext;defext=.rl6.cpp:SRC} ${input:SRC} ${hide;kv:"p R6"} ${hide;kv:"pc yellow"}
  2707. .SEM=target_macroses-ITEM && target_macroses-macro target_ragel_lexers && target_macroses-args PRIVATE ${input:SRC} ${hide;output;suf=${OBJ_SUF}.o:SRC} $RAGEL6_FLAGS ${SRCFLAGS} && platform_vars-RAGEL_FLAGS "-L -I $S/" && conan-tool_requires ragel/6.10 && conan-imports 'bin, ragel* -> ./bin' ${hide;input:"build/scripts/run_tool.py"}
  2708. }
  2709. # tag:src-processing
  2710. macro _SRC("xsyn", SRC, SRCFLAGS...) {
  2711. .CMD=$YMAKE_PYTHON ${input:"library/cpp/xml/parslib/xsyn2ragel.py"} ${input:SRC} ${input:"library/cpp/xml/parslib/xmlpars.xh"} dontuse ${stdout;output:SRC.h.rl5} ${hide;kv:"p XN"} ${hide;kv:"pc yellow"}
  2712. }
  2713. # tag:src-processing
  2714. macro _SRC("ev", SRC, SRCFLAGS...) {
  2715. .CMD=$EVLOG_CMD($SRC)
  2716. .SEM=$EVLOG_CMD($SRC)
  2717. }
  2718. # tag:src-processing
  2719. macro _SRC("proto", SRC, SRCFLAGS...) {
  2720. .CMD=$PROTO_CMD($SRC)
  2721. .SEM=$PROTO_CMD($SRC)
  2722. }
  2723. # tag:src-processing
  2724. macro _SRC("gztproto", SRC, SRCFLAGS...) {
  2725. # _PROTO__INCLUDE is before ARCADIA_ROOT in includes because in gazetteer we don't use builtins now and paths' canonization (resolving) depends on order of roots.
  2726. # descriptor.proto must be resolved as google/protobuf/descriptor.proto
  2727. .CMD=${tool:"dict/gazetteer/converter"} -I$PROTOBUF_INCLUDE_PATH ${pre="-I":_PROTO__INCLUDE} -I$ARCADIA_ROOT ${SRCFLAGS} ${input:SRC} ${output;nopath;noext;norel:SRC.proto} ${hide;kv:"p GZ"} ${hide;kv:"pc yellow"}
  2728. .PEERDIR=kernel/gazetteer/proto
  2729. }
  2730. # tag:src-processing
  2731. macro _SRC("cfgproto", SRC, SRCFLAGS...) {
  2732. .CMD=$_CPP_CFGPROTO_CMD($SRC)
  2733. }
  2734. # tag:src-processing
  2735. macro _SRC("pyx", SRC, SRCFLAGS...) {
  2736. # Copy-paste from BUILDWITH_CYTHON
  2737. .CMD=$RUN_CYTHON_SCRIPT $CYTHON_OPTIONS --cplus ${CYTHON_CPP_OUTPUT_INCLUDES} ${pre=-I:_CYTHON__INCLUDE} ${input:SRC} -o ${output;tobindir;suf=${OBJ_SUF}.cpp:SRC} $CYTHON_OUTPUT_INCLUDES ${SRCFLAGS} ${hide;kv:"p CY"} ${hide;kv:"pc yellow"}
  2738. .SEM=target_options-privates-ITEM && target_options-privates-option target_cython_sources && target_options-privates-args ${input:Src} ${hide;output;tobindir:Src.fake.o} && target_macroses-ITEM && target_macroses-macro target_cython_options && target_macroses-args $CYTHON_OPTIONS --cplus ${SRCFLAGS} ${CYTHON_CPP_OUTPUT_INCLUDES} && target_macroses-ITEM && target_macroses-macro target_cython_include_directories && target_macroses-args $_CYTHON__INCLUDE && target_macroses-ITEM && target_macroses-macro set_python_type_for_cython && target_macroses-args $PYTHON_TYPE_FOR_CYTHON
  2739. .ADDINCL=FOR cython contrib/tools/cython/Cython/Includes
  2740. }
  2741. # tag:src-processing
  2742. macro _SRC("in", SRC, SRCFLAGS...) {
  2743. .CMD=$CONFIGURE_FILE(${SRC} ${nopath;noext:SRC})
  2744. .SEM=$CONFIGURE_FILE(${SRC} ${nopath;noext:SRC})
  2745. }
  2746. macro MANUAL_GENERATION(Outs...) {
  2747. .SEM=$_SEM_IGNORED ${hide;noauto;output:Outs}
  2748. }
  2749. # tag:src-processing
  2750. macro _SRC("sc", SRC, SRCFLAGS...) {
  2751. .CMD=${tool:"tools/domschemec"} --in ${input:SRC} --out ${output;norel:SRC.h} ${hide;output_include:"library/cpp/domscheme/runtime.h"} ${SRCFLAGS} ${hide;kv:"p SC"} ${hide;kv:"pc yellow"}
  2752. .PEERDIR=library/cpp/domscheme
  2753. }
  2754. # tag:src-processing
  2755. macro _SRC("ssqls", SRC, SRCFLAGS...) {
  2756. .CMD=${tool:"metrika/core/tools/ssqls"} ${input;notransformbuilddir:SRC} -S $ARCADIA_ROOT -B $ARCADIA_BUILD_ROOT $SRCFLAGS ${output;noext;hide:SRC.cpp} ${output;noext;hide:SRC.h} ${hide;kv:"p SS"} ${hide;kv:"pc yellow"}
  2757. }
  2758. macro _SRC_f_new(SRC, SRCFLAGS...) {
  2759. .CMD=${tool:"build/platform/flang"} -c ${input:SRC} -o ${output:SRC.o} ${hide;kv:"p FL"} ${hide;kv:"pc light-green"}
  2760. }
  2761. macro _SRC_f_old(SRC, SRCFLAGS...) {
  2762. .CMD=$YMAKE_PYTHON ${input:"build/scripts/f2c.py"} -t ${tool:"contrib/tools/f2c"} -c ${input:SRC} -o ${output:SRC.c} ${hide;output_include:"f2c.h"} ${hide;kv:"p FT"} ${hide;kv:"pc light-green"}
  2763. }
  2764. ### @usage: AR_PLUGIN(plugin_name)
  2765. ###
  2766. ### Register script, which will process module's .a (archive) output
  2767. ### Script will receive path to archive, which it should modify in place
  2768. macro AR_PLUGIN(name) {
  2769. SET(_AR_PLUGIN $name.pyplugin)
  2770. }
  2771. ### @usage: LD_PLUGIN(plugin_name)
  2772. ###
  2773. ### Register script, which will process all inputs to any link_exe.py call with modules's library
  2774. ### Script will receive all arguments to link_exe.py, and can output into stdout preprocessed list
  2775. ### of all arguments, in JSON format
  2776. macro LD_PLUGIN(Name) {
  2777. .CMD=$COPY_CMD ${context=TEXT;input:Name} ${noauto;output;global;suf=.pyplugin:Name}
  2778. .SEM=_SEM_IGNORED
  2779. }
  2780. USE_FLANG=no
  2781. when ($USE_FLANG == "yes") {
  2782. _SRC_FLANG=$_SRC_f_new($SRC, $SRCFLAGS)
  2783. }
  2784. otherwise {
  2785. _SRC_FLANG=$_SRC_f_old($SRC, $SRCFLAGS)
  2786. }
  2787. # tag:src-processing
  2788. macro _SRC("f", SRC, SRCFLAGS...) {
  2789. .CMD=$_SRC_FLANG
  2790. .PEERDIR=contrib/libs/libf2c
  2791. .ADDINCL=contrib/libs/libf2c
  2792. }
  2793. _SRC_CPP_TOOLCHAIN_INFO_PEER=
  2794. # tag:src-processing
  2795. macro _SRC("cpp", SRC, SRCFLAGS...) {
  2796. .CMD=$_SRC_cpp_new($SRC $SRCFLAGS)
  2797. .PEERDIR=$_SRC_CPP_TOOLCHAIN_INFO_PEER
  2798. .SEM=target_options-privates-ITEM && target_options-privates-option target_sources && target_options-privates-args ${input:SRC} ${hide;output;suf=${OBJ_SUF}.o:SRC} $_ADD_EXTRA_FLAGS($SRCFLAGS)
  2799. .STRUCT_CMD=yes
  2800. }
  2801. # tag:src-processing
  2802. macro _SRC("cxx", SRC, SRCFLAGS...) {
  2803. .CMD=$_SRC_cpp_new($SRC $SRCFLAGS)
  2804. .PEERDIR=$_SRC_CPP_TOOLCHAIN_INFO_PEER
  2805. .SEM=target_options-privates-ITEM && target_options-privates-option target_sources && target_options-privates-args ${input:SRC} ${hide;output;suf=${OBJ_SUF}.o:SRC} $_ADD_EXTRA_FLAGS($SRCFLAGS)
  2806. .STRUCT_CMD=yes
  2807. }
  2808. # tag:src-processing
  2809. macro _SRC("cc", SRC, SRCFLAGS...) {
  2810. .CMD=$_SRC_cpp_new($SRC $SRCFLAGS)
  2811. .PEERDIR=$_SRC_CPP_TOOLCHAIN_INFO_PEER
  2812. .SEM=target_options-privates-ITEM && target_options-privates-option target_sources && target_options-privates-args ${input:SRC} ${hide;output;suf=${OBJ_SUF}.o:SRC} $_ADD_EXTRA_FLAGS($SRCFLAGS)
  2813. .STRUCT_CMD=yes
  2814. }
  2815. # tag:src-processing
  2816. macro _SRC("auxcpp", SRC, SRCFLAGS...) {
  2817. .CMD=$_SRC_cpp_new($SRC $_FORCE_CPP_FLAGS $SRCFLAGS)
  2818. .PEERDIR=$_SRC_CPP_TOOLCHAIN_INFO_PEER
  2819. .SEM=target_options-privates-ITEM && target_options-privates-option target_sources && target_options-privates-args ${input:SRC} ${hide;output;suf=${OBJ_SUF}.o:SRC} $_ADD_EXTRA_FLAGS($_FORCE_CPP_FLAGS $SRCFLAGS)
  2820. .STRUCT_CMD=yes
  2821. }
  2822. # tag:src-processing
  2823. macro _SRC("C", SRC, SRCFLAGS...) {
  2824. .CMD=$_SRC_cpp_new($SRC $SRCFLAGS)
  2825. .PEERDIR=$_SRC_CPP_TOOLCHAIN_INFO_PEER
  2826. .SEM=target_options-privates-ITEM && target_options-privates-option target_sources && target_options-privates-args ${input:SRC} ${hide;output;suf=${OBJ_SUF}.o:SRC} $_ADD_EXTRA_FLAGS($SRCFLAGS)
  2827. .STRUCT_CMD=yes
  2828. }
  2829. # tag:src-processing
  2830. macro _SRC("c", SRC, SRCFLAGS...) {
  2831. .CMD=$_SRC_c_new($SRC $SRCFLAGS)
  2832. .PEERDIR=$_SRC_CPP_TOOLCHAIN_INFO_PEER
  2833. .SEM=target_options-privates-ITEM && target_options-privates-option target_sources && target_options-privates-args ${input:SRC} ${hide;output;suf=${OBJ_SUF}.o:SRC} $_ADD_EXTRA_FLAGS($SRCFLAGS $USER_CONLYFLAGS $USER_CONLYFLAGS_GLOBAL)
  2834. .STRUCT_CMD=yes
  2835. }
  2836. # tag:src-processing
  2837. macro _SRC("m", SRC, SRCFLAGS...) {
  2838. .CMD=$_SRC(c $SRC $SRCFLAGS)
  2839. }
  2840. _MASM_SEM=target_options-privates-ITEM && target_options-privates-option target_sources && target_options-privates-args ${input:SRC} ${hide;output;suf=${OBJ_SUF}.o:SRC} \
  2841. && dir_macroses-ITEM && dir_macroses-macro curdir_masm_flags && dir_macroses-args ${MASMFLAGS}
  2842. _YASM_SEM=target_macroses-ITEM && target_macroses-macro target_yasm_source && target_macroses-args PRIVATE ${input:SRC} ${hide;output;suf=${OBJ_SUF}.o:SRC} $YASM_FLAGS ${pre=-I :_ASM__INCLUDE} $SRCFLAGS ${pre=-P :PREINCLUDES} ${hide;input:"build/scripts/run_tool.py"} \
  2843. && platform_vars-YASM_FLAGS "-f ${_YASM_FMT_VALUE}${HARDWARE_ARCH} $_YASM_PLATFORM_FLAGS_VALUE -D ${pre=_;suf=_:HARDWARE_TYPE} -D _YASM_ $ASM_PREFIX_VALUE $_YASM_PREDEFINED_FLAGS_VALUE" \
  2844. && project_languages ASM \
  2845. && conan-tool_requires yasm/1.3.0 && conan-imports 'bin, *yasm* -> ./bin' && conan-imports 'bin, ytasm* -> ./bin'
  2846. _ASM_SEM=target_macroses-ITEM && target_macroses-macro target_yasm_source && target_macroses-args PRIVATE ${input:SRC} ${hide;output;suf=${OBJ_SUF}.o:SRC} $YASM_FLAGS ${pre=-I :_ASM__INCLUDE} $SRCFLAGS ${hide;input:"build/scripts/run_tool.py"} \
  2847. && platform_vars-YASM_FLAGS "-f ${_YASM_FMT_VALUE}${HARDWARE_ARCH} $_YASM_PLATFORM_FLAGS_VALUE -D ${pre=_;suf=_:HARDWARE_TYPE} -D _YASM_ $ASM_PREFIX_VALUE $_YASM_PREDEFINED_FLAGS_VALUE" \
  2848. && project_languages ASM \
  2849. && conan-tool_requires yasm/1.3.0 && conan-imports 'bin, *yasm* -> ./bin' && conan-imports 'bin, ytasm* -> ./bin'
  2850. # tag:src-processing
  2851. macro _SRC("masm", SRC, SRCFLAGS...) {
  2852. .CMD=$_SRC_masm($SRC $SRCFLAGS)
  2853. .SEM=$_MASM_SEM
  2854. }
  2855. # tag:src-processing
  2856. macro _SRC("yasm", SRC, SRCFLAGS...) {
  2857. .CMD=$_SRC_yasm($SRC $SRCFLAGS PREINCLUDES $YASM_PREINCLUDES_VALUE)
  2858. .SEM=$_YASM_SEM
  2859. }
  2860. # tag:src-processing
  2861. macro _SRC("asm", SRC, SRCFLAGS...) {
  2862. .CMD=$_SRC_ASM($SRC $SRCFLAGS PREINCLUDES $YASM_PREINCLUDES_VALUE)
  2863. .SEM=$_ASM_SEM
  2864. }
  2865. # tag:src-processing
  2866. macro _SRC("lua", SRC, SRCFLAGS...) {
  2867. .CMD=${cwd:LUAJIT_PATH} ${tool:"contrib/libs/luajit/compiler"} -b -g ${input:SRC} ${SRCFLAGS} ${global;output;suf=.o:SRC} ${hide;kv:"p LJ"} ${hide;kv:"pc light-cyan"}
  2868. .PEERDIR=$LUAJIT_PATH
  2869. }
  2870. when ($MSVC == "yes") {
  2871. NVCC_STD=/std:c++${NVCC_STD_VER}
  2872. }
  2873. otherwise {
  2874. NVCC_STD=-std=c++${NVCC_STD_VER}
  2875. }
  2876. # tag:src-processing
  2877. macro _SRC("cu", SRC, SRCFLAGS...) {
  2878. .CMD=$_SRC_CU_CMD
  2879. .SEM=target_options-privates-ITEM && target_options-privates-option target_cuda_sources && target_options-privates-args ${input:SRC} ${hide;output;suf=${OBJ_SUF}.o:SRC} && platform_vars-CMAKE_CUDA_STANDARD ${quo:NVCC_STD_VER} && target_macroses-ITEM && target_macroses-macro target_cuda_flags && target_macroses-args $CUDA_NVCC_FLAGS && target_macroses-ITEM && target_macroses-macro target_cuda_cflags && target_macroses-args $USER_CXXFLAGS $SRCFLAGS $_SEM_EXTRA_CXX_FLAGS
  2880. .STRUCT_CMD=yes
  2881. .PEERDIR=$_SRC_CU_PEERDIR
  2882. }
  2883. # tag:src-processing
  2884. macro _SRC("fbs", SRC, SRCFLAGS...) {
  2885. .CMD=$FBS_CMD($SRC, $SRCFLAGS)
  2886. .SEM=$FBS_CMD($SRC, $SRCFLAGS)
  2887. }
  2888. # tag:src-processing
  2889. macro _SRC("fbs64", SRC, SRCFLAGS...) {
  2890. .CMD=$_CPP_FLATC64_CMD($SRC, $SRCFLAGS)
  2891. }
  2892. # tag:src-processing
  2893. macro _SRC("pysrc", SRC, SRCFLAGS...) {
  2894. .CMD=$_SRC_PYSRC($SRC, $SRCFLAGS)
  2895. }
  2896. # tag:src-processing
  2897. # This triggers configure error in attempt to add `ya.make` to SRCS macro or apply automatic processing by extension from codegen
  2898. macro _SRC("make", SRC, SRCFLAGS...) {
  2899. .CMD=
  2900. }
  2901. @import "${CONF_ROOT}/conf/bison_lex.conf"
  2902. # tag:src-processing
  2903. macro _SRC_py2src(SRC, SRCFLAGS...) {
  2904. .CMD=${cwd:BINDIR} $YMAKE_PYTHON3 ${input:"build/scripts/compile_pysrc.py"} --input ${input:SRC} --output ${output;noext;suf=.py2_raw.cpp:SRC} --rescompiler ${tool:"tools/rescompiler"} py2 --python $(PYTHON)/python --py_compile ${input:"build/scripts/py_compile.py"} ${hide;kv:"p P2"} ${hide;kv:"pc light-green"}
  2905. }
  2906. # tag:src-processing
  2907. macro _SRC_py3src(SRC, SRCFLAGS...) {
  2908. .CMD=${cwd:BINDIR} $YMAKE_PYTHON3 ${input:"build/scripts/compile_pysrc.py"} --input ${input:SRC} --output ${output;noext;suf=.py3_raw.cpp:SRC} --rescompiler ${tool:"tools/rescompiler"} py3 --pycc ${tool:"tools/py3cc"} ${hide;kv:"p P3"} ${hide;kv:"pc light-green"}
  2909. }
  2910. # tag:src-processing python-specific
  2911. when ($PYTHON3 == "yes") {
  2912. _SRC_PYSRC_CMDLINE=$_SRC_py3src($SRC $SRCFLAGS)
  2913. }
  2914. elsewhen ($PYTHON2 == "yes") {
  2915. _SRC_PYSRC_CMDLINE=$_SRC_py2src($SRC $SRCFLAGS)
  2916. }
  2917. otherwise {
  2918. _SRC_PYSRC_CMDLINE=
  2919. }
  2920. # tag:src-processing tag:python-specific
  2921. macro _SRC_PYSRC(SRC, SRCFLAGS...) {
  2922. .CMD=$_SRC_PYSRC_CMDLINE
  2923. }
  2924. # tag:src-processing
  2925. macro _SRC_c_nodeps(SRC, OUTFILE, INC...) {
  2926. # this macro is used by link commands; TODO switch to the new engine after those
  2927. .CMD=$_SRC_C_NODEPS_CMD
  2928. }
  2929. # Custom flags for generated cpp-files
  2930. #
  2931. # ragel5 and ragel6 generated terrible code which makes use of goto's in switch statements.
  2932. # This triggers -Werror-implicit-fallthrough due to `unannotated fall-through between switch labels`.
  2933. #
  2934. # cython generated code also fails to pass this diagnostics due to `fallthrough annotation in unreachable code`.
  2935. # We use cython==0.29.26 at the time. This issue might be fixed in further versions.
  2936. #
  2937. # flags -fno-profile-instr-generate -fno-coverage-mapping needed to always disable coverage for .pyx, .rl5, .rl6
  2938. # generated sources
  2939. ## tag:src-processing
  2940. when ($CLANG == "yes") {
  2941. _LANG_CFLAGS_RL=-Wno-implicit-fallthrough -fno-profile-instr-generate -fno-coverage-mapping
  2942. _LANG_CFLAGS_SWG=-Wno-deprecated-declarations -fno-profile-instr-generate -fno-coverage-mapping
  2943. _LANG_CFLAGS_LEX=-Wno-unused-variable -fno-profile-instr-generate -fno-coverage-mapping
  2944. _LANG_CFLAGS_BISON=-Wno-unused-but-set-variable -Wno-deprecated-copy -fno-profile-instr-generate -fno-coverage-mapping
  2945. }
  2946. otherwise {
  2947. _LANG_CFLAGS_RL=-Wno-implicit-fallthrough
  2948. _LANG_CFLAGS_SWG=-Wno-deprecated-declarations
  2949. _LANG_CFLAGS_LEX=-Wno-unused-variable
  2950. _LANG_CFLAGS_BISON=-Wno-unused-but-set-variable -Wno-deprecated-copy
  2951. }
  2952. # tag:src-processing
  2953. # ymake bug workaround: variables followed a macros call in .CMD are not substituted and are placed in result as is
  2954. # Pack macro call into a variable and use it in _SRC_CPP_CMD instead of macro call
  2955. _LANG_CFLAGS_VALUE_NEW=
  2956. when ($CLANG == "yes" || $CLANG_CL == "yes" || $GCC == "yes") {
  2957. _LANG_CFLAGS_VALUE_NEW=\
  2958. ${pre=$_LANG_CFLAGS_BISON;clear;ext=.y;noext;input:SRC} \
  2959. ${pre=$_LANG_CFLAGS_BISON;clear;ext=.ypp;noext;input:SRC} \
  2960. ${pre=$_LANG_CFLAGS_RL;clear;ext=.rl5;noext;input:SRC} \
  2961. ${pre=$_LANG_CFLAGS_RL;clear;ext=.rl6;noext;input:SRC} \
  2962. ${pre=$_LANG_CFLAGS_RL;clear;ext=.pyx;noext;input:SRC} \
  2963. ${pre=$_LANG_CFLAGS_SWG;clear;ext=.swg;noext;input:SRC} \
  2964. ${pre=$_LANG_CFLAGS_LEX;clear;ext=.l;noext;input:SRC}
  2965. }
  2966. # Allows to add single compilation unit name to the node's 'kv' section.
  2967. # This is used by the coverage machinery to instrument only the necessary sources
  2968. # when --coverage-prefix-filter <rootrelpath> is specified. For more info see DEVTOOLSSUPPORT-16891
  2969. SCU_NAME_KV_NEW=
  2970. SCU_NAME_KV_NEW_BODY=scu_name ${input:SRC}
  2971. when ($CLANG_COVERAGE && $CLANG_COVERAGE != "no" && $USE_SCU_VALUE == "yes") {
  2972. SCU_NAME_KV_NEW=${hide;kv:SCU_NAME_KV_NEW_BODY}
  2973. }
  2974. macro _ADD_SCU_NAME_NEW(KV_VAL) {
  2975. .CMD=$SCU_NAME_KV_NEW
  2976. }
  2977. # tag:src-processing
  2978. macro _SRC_cpp_new(SRC, COMPILE_OUT_SUFFIX="", SRCFLAGS...) {
  2979. .CMD=$_SRC_CPP_CMD_NEW && $_ADD_SCU_NAME_NEW(${input:SRC})
  2980. }
  2981. # tag:src-processing
  2982. macro _SRC_c_new(SRC, COMPILE_OUT_SUFFIX="", SRCFLAGS...) {
  2983. .CMD=$_SRC_C_CMD_NEW $_ADD_SCU_NAME_NEW(${input:SRC})
  2984. }
  2985. # tag:src-processing
  2986. macro _SRC_m(SRC, SRCFLAGS...) {
  2987. .CMD=$_SRC_M_CMD
  2988. }
  2989. # tag:src-processing
  2990. macro _SRC_masm(SRC, SRCFLAGS...) {
  2991. .CMD=$_SRC_MASM_CMD
  2992. }
  2993. # tag:lua-specific
  2994. ### @usage: COMPILE_LUA(Src, [NAME <import_name>])
  2995. ###
  2996. ### Compile LUA source file to object code using LUA 2.0
  2997. ### Optionally override import name which is by default reflects Src name
  2998. macro COMPILE_LUA(Src, NAME="") {
  2999. .CMD=$_SRC(lua, $Src, ${pre=-n :NAME})
  3000. }
  3001. # tag:lua-specific
  3002. ### @usage: _SRC_lua_21(SRC [SRCFLAGS...]) # internal
  3003. ###
  3004. ### Compile LUA source file to object code using LUA 2.1
  3005. macro _SRC_lua_21(SRC, SRCFLAGS...) {
  3006. .CMD=${cwd:LUAJIT_21_PATH} ${tool:"contrib/libs/luajit_21/compiler"} -b -g ${input:SRC} ${SRCFLAGS} ${global;output;suf=.o:SRC} ${hide;kv:"p LJ"} ${hide;kv:"pc light-cyan"}
  3007. .PEERDIR=$LUAJIT_21_PATH
  3008. }
  3009. # tag:lua-specific
  3010. ### @usage: COMPILE_LUA_21(Src, [NAME <import_name>])
  3011. ###
  3012. ### Compile LUA source file to object code using LUA 2.1
  3013. ### Optionally override import name which is by default reflects Src name
  3014. macro COMPILE_LUA_21(Src, NAME="") {
  3015. .CMD=$_SRC_lua_21($Src, ${pre=-n :NAME})
  3016. }
  3017. # tag:lua-specific
  3018. ### @usage: _SRC_lua_openresty(SRC [SRCFLAGS...]) # internal
  3019. ###
  3020. ### Compile LUA source file to object code using OpenResty LUA 2.1
  3021. macro _SRC_lua_openresty(SRC, SRCFLAGS...) {
  3022. .CMD=${cwd:LUAJIT_OPENRESTY_PATH} ${tool:"contrib/libs/luajit_openresty/compiler"} -b -g ${input:SRC} ${SRCFLAGS} ${global;output;suf=.o:SRC} ${hide;kv:"p LJ"} ${hide;kv:"pc light-cyan"}
  3023. .PEERDIR=$LUAJIT_OPENRESTY_PATH
  3024. }
  3025. # tag:lua-specific
  3026. ### @usage: COMPILE_LUA_OPENRESTY(Src, [NAME <import_name>])
  3027. ###
  3028. ### Compile LUA source file to object code using OpenResty LUA 2.1
  3029. ### Optionally override import name which is by default reflects Src name
  3030. macro COMPILE_LUA_OPENRESTY(Src, NAME="") {
  3031. .CMD=$_SRC_lua_openresty($Src, ${pre=-n :NAME})
  3032. }
  3033. GETTEXT_KEEP_PATH=no
  3034. _MO_OUTPUT=
  3035. when ($GETTEXT_KEEP_PATH == "yes") {
  3036. _MO_OUTPUT=${noauto;output;norel;noext:SRC.mo}
  3037. }
  3038. otherwise {
  3039. _MO_OUTPUT=${noauto;output;nopath;noext;tobindir:SRC.mo}
  3040. }
  3041. # tag:src-processing
  3042. macro _SRC("po", SRC, SRCFLAGS...) {
  3043. .CMD=$YMAKE_PYTHON ${input:"contrib/tools/python/src/Tools/i18n/msgfmt.py"} -o $_MO_OUTPUT ${input:SRC}
  3044. }
  3045. # tag:ydl-specific
  3046. YDL_FLAGS= --force-color -I ${ARCADIA_ROOT}
  3047. YDL_DESC_FLAGS=
  3048. # tag:src-processing tag:ydl-specific
  3049. macro _SRC("ydl", SRC, SRCFLAGS...) {
  3050. .CMD=${tool:"statbox/ydl/compiler/tooling/ydl/bin"} c $YDL_FLAGS --cpp-output-header ${output;suf=.h:SRC} --cpp-output-source ${output;suf=.cpp:SRC} ${input:SRC} ${hide;output_include:"statbox/ydl/runtime/cpp/gen_support/standard_includes.h"} ${hide;kv:"p YDL"} ${hide;kv:"pc yellow"}
  3051. .PEERDIR+=statbox/ydl/runtime/cpp
  3052. }
  3053. # tag:ydl-specific
  3054. ### @usage: BUILD_YDL_DESC(Input Symbol Output)
  3055. ###
  3056. ### Generate a descriptor for a Symbol located in a ydl module Input, and put it to the file Output.
  3057. ###
  3058. ### @example:
  3059. ###
  3060. ### PACKAGE()
  3061. ### BUILD_YDL_DESC(../types.ydl Event Event.ydld)
  3062. ### END()
  3063. ###
  3064. ### This will parse file ../types.ydl, generate a descriptor for a symbol Event defined in the said file, and put the descriptor to the Event.ydld.
  3065. macro BUILD_YDL_DESC(Input, Symbol, Output) {
  3066. .CMD=${tool:"statbox/ydl/compiler/tooling/ydl/bin"} ti $YDL_FLAGS $YDL_DESC_FLAGS -o ${noauto;output:Output} ${input:Input} ${Symbol} ${hide;kv:"p YDL"} ${hide;kv:"pc yellow"}
  3067. }
  3068. # tag:ydl-specific
  3069. ### @usage: YDL_DESC_USE_BINARY()
  3070. ###
  3071. ### Used in conjunction with BUILD_YDL_DESC. When enabled, all generated descriptors are binary.
  3072. ###
  3073. ### @example:
  3074. ###
  3075. ### PACKAGE()
  3076. ### YDL_DESC_USE_BINARY()
  3077. ### BUILD_YDL_DESC(../types.ydl Event Event.ydld)
  3078. ### END()
  3079. ###
  3080. ### This will generate descriptor Event.ydld in a binary format.
  3081. macro YDL_DESC_USE_BINARY() {
  3082. YDL_DESC_FLAGS_BINARY= --binary
  3083. SET_APPEND(YDL_DESC_FLAGS $YDL_DESC_FLAGS_BINARY)
  3084. }
  3085. ### @usage: SRC(File Flags...)
  3086. ###
  3087. ### Compile single file with extra Flags.
  3088. ### Compilation is driven by the last extension of the File and Flags are specific to corresponding compilation command
  3089. macro SRC(FILE, FLAGS...) {
  3090. _SRC(${lastext:FILE} $FILE $FLAGS)
  3091. }
  3092. ### @usage: SRCS(<[GLOBAL] File> ...)
  3093. ###
  3094. ### Source files of the project. Files are built according to their extension and put int module output or fed to ultimate PROGRAM/DLL depending on GLOBAL presence.
  3095. ### Arcadia Paths from the root and is relative to the project's LIST are supported
  3096. ###
  3097. ### GLOBAL marks next file as direct input to link phase of the program/shared library project built into. This prevents symbols of the file to be excluded by linker as unused.
  3098. ### The scope of the GLOBAL keyword is the following file (that is, in the case of SRCS(GLOBAL foo.cpp bar.cpp) global will be only foo.cpp)
  3099. ###
  3100. ### @example:
  3101. ###
  3102. ### LIBRARY(test_global)
  3103. ### SRCS(GLOBAL foo.cpp)
  3104. ### END()
  3105. ###
  3106. ### This will produce foo.o and feed it to any PROGRAM/DLL module transitively depending on test_global library. The library itself will be empty and won't produce .a file.
  3107. macro SRCS(FILES...) {
  3108. foreach (FILE : $FILES) {
  3109. _SRC(${lastext:FILE} $FILE)
  3110. }
  3111. }
  3112. # tag:c-specific
  3113. macro _SRC_C_CUSTOM_FLAGS(SRC, COMPILE_OUT_SUFFIX, CUSTOM_FLAGS...) {
  3114. .CMD=$_SRC_c_new($SRC COMPILE_OUT_SUFFIX ${COMPILE_OUT_SUFFIX} ${CUSTOM_FLAGS})
  3115. .SEM=target_macroses-ITEM && target_macroses-macro target_sources_custom && target_macroses-args $COMPILE_OUT_SUFFIX SRCS ${input:SRC} ${hide;output;suf=${COMPILE_OUT_SUFFIX}.o:SRC} CUSTOM_FLAGS $CUSTOM_FLAGS $USER_CONLYFLAGS $USER_CONLYFLAGS_GLOBAL
  3116. .STRUCT_CMD=yes
  3117. }
  3118. macro _SRC_CPP_CUSTOM_FLAGS(SRC, COMPILE_OUT_SUFFIX, CUSTOM_FLAGS...) {
  3119. .CMD=$_SRC_cpp_new($SRC COMPILE_OUT_SUFFIX ${COMPILE_OUT_SUFFIX} ${CUSTOM_FLAGS})
  3120. .SEM=target_macroses-ITEM && target_macroses-macro target_sources_custom && target_macroses-args $COMPILE_OUT_SUFFIX SRCS ${input:SRC} ${hide;output;suf=${COMPILE_OUT_SUFFIX}.o:SRC} CUSTOM_FLAGS $CUSTOM_FLAGS
  3121. .STRUCT_CMD=yes
  3122. }
  3123. # tag:src-specific tag:cpp-specific
  3124. ### @usage: _SRC_CUSTOM_C_CPP(Ext MacroName File Flags...) # internal
  3125. ###
  3126. ### Defenition of generic macro. Report an error that the File with Ext is not
  3127. ### supported by macro MacroName if no appropriate macro specialization is found.
  3128. macro _SRC_CUSTOM_C_CPP(EXT, MACRO_NAME, FILE, COMPILE_OUT_SUFFIX, FLAGS...) {
  3129. MESSAGE(FATAL_ERROR macro [[alt1]]$MACRO_NAME[[rst]] does not support files with [[imp]].$EXT[[rst]] extension)
  3130. }
  3131. # tag:src-specific tag:cpp-specific
  3132. ### @usage: _SRC_CUSTOM_C_CPP(Ext MacroName File Flags...) # internal
  3133. ###
  3134. ### Specialization of genreric macro _SRC_CUSTOM_C_CPP which compiles a single C file (with .c extension)
  3135. macro _SRC_CUSTOM_C_CPP("c", MACRO_NAME, FILE, COMPILE_OUT_SUFFIX, FLAGS...) {
  3136. _SRC_C_CUSTOM_FLAGS($FILE $COMPILE_OUT_SUFFIX $FLAGS)
  3137. }
  3138. # tag:src-specific tag:cpp-specific
  3139. ### @usage: _SRC_CUSTOM_C_CPP(Ext MacroName File Flags...) # internal
  3140. ###
  3141. ### Specialization of genreric macro _SRC_CUSTOM_C_CPP which compiles a single Cpp file (with .cpp extension)
  3142. macro _SRC_CUSTOM_C_CPP("cpp", MACRO_NAME, FILE, COMPILE_OUT_SUFFIX, FLAGS...) {
  3143. _SRC_CPP_CUSTOM_FLAGS($FILE $COMPILE_OUT_SUFFIX $FLAGS)
  3144. }
  3145. # tag:src-specific tag:cpp-specific
  3146. ### @usage: _SRC_CUSTOM_C_CPP(Ext MacroName File Flags...) # internal
  3147. ###
  3148. ### Specialization of genreric macro _SRC_CUSTOM_C_CPP which compiles a single Cpp file (with .cxx extension)
  3149. macro _SRC_CUSTOM_C_CPP("cxx", MACRO_NAME, FILE, COMPILE_OUT_SUFFIX, FLAGS...) {
  3150. _SRC_CPP_CUSTOM_FLAGS($FILE $COMPILE_OUT_SUFFIX $FLAGS)
  3151. }
  3152. # tag:src-specific tag:cpp-specific
  3153. ### @usage: _SRC_CUSTOM_C_CPP(Ext MacroName File Flags...) # internal
  3154. ###
  3155. ### Specialization of genreric macro _SRC_CUSTOM_C_CPP which compiles a single Cpp file (with .cc extension)
  3156. macro _SRC_CUSTOM_C_CPP("cc", MACRO_NAME, FILE, COMPILE_OUT_SUFFIX, FLAGS...) {
  3157. _SRC_CPP_CUSTOM_FLAGS($FILE $COMPILE_OUT_SUFFIX $FLAGS)
  3158. }
  3159. # tag:src-specific tag:cpp-specific
  3160. ### @usage: _SRC_CUSTOM_C_CPP(Ext MacroName File Flags...) # internal
  3161. ###
  3162. ### Specialization of genreric macro _SRC_CUSTOM_C_CPP which compiles a single Cpp file (with .C extension)
  3163. macro _SRC_CUSTOM_C_CPP("C", MACRO_NAME, FILE, COMPILE_OUT_SUFFIX, FLAGS...) {
  3164. _SRC_CPP_CUSTOM_FLAGS($FILE $COMPILE_OUT_SUFFIX $FLAGS)
  3165. }
  3166. # tag:src-specific tag:cpp-specific tag:cpu
  3167. ### @usage: SRC_C_SSE2(File Flags...)
  3168. ###
  3169. ### Compile a single C/C++ file with SSE2 and additional Flags
  3170. macro SRC_C_SSE2(FILE, FLAGS...) {
  3171. _SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_SSE2 $FILE .sse2 $SSE2_CFLAGS $FLAGS)
  3172. }
  3173. # tag:src-specific tag:cpp-specific tag:cpu
  3174. ### @usage: SRC_C_SSE3(File Flags...)
  3175. ###
  3176. ### Compile a single C/C++ file with SSE3 and additional Flags
  3177. macro SRC_C_SSE3(FILE, FLAGS...) {
  3178. _SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_SSE3 $FILE .sse3 $SSE3_CFLAGS $FLAGS)
  3179. }
  3180. # tag:src-specific tag:cpp-specific tag:cpu
  3181. ### @usage: SRC_C_SSSE3(File Flags...)
  3182. ###
  3183. ### Compile a single C/C++ file with SSSE3 and additional Flags
  3184. macro SRC_C_SSSE3(FILE, FLAGS...) {
  3185. _SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_SSSE3 $FILE .ssse3 $SSSE3_CFLAGS $FLAGS)
  3186. }
  3187. # tag:src-specific tag:cpp-specific tag:cpu
  3188. ### @usage: SRC_C_SSE4(File Flags...)
  3189. ###
  3190. ### Compile a single C/C++ file with SSE4 and additional Flags
  3191. macro SRC_C_SSE4(FILE, FLAGS...) {
  3192. _SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_SSE4 $FILE .sse4 $SSE4_CFLAGS $FLAGS)
  3193. }
  3194. # tag:src-specific tag:cpp-specific tag:cpu
  3195. ### @usage: SRC_C_SSE41(File Flags...)
  3196. ###
  3197. ### Compile a single C/C++ file with SSE4.1 and additional Flags
  3198. macro SRC_C_SSE41(FILE, FLAGS...) {
  3199. _SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_SSE41 $FILE .sse41 $SSE41_CFLAGS $FLAGS)
  3200. }
  3201. # tag:src-specific tag:cpp-specific tag:cpu
  3202. ### @usage: SRC_C_AVX(File Flags...)
  3203. ###
  3204. ### Compile a single C/C++ file with AVX and additional Flags
  3205. macro SRC_C_AVX(FILE, FLAGS...) {
  3206. _SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_AVX $FILE .avx $AVX_CFLAGS $FLAGS)
  3207. }
  3208. # tag:src-specific tag:cpp-specific tag:cpu
  3209. ### @usage: SRC_C_AVX2(File Flags...)
  3210. ###
  3211. ### Compile a single C/C++ file with AVX2 and additional Flags
  3212. macro SRC_C_AVX2(FILE, FLAGS...) {
  3213. _SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_AVX2 $FILE .avx2 $AVX2_CFLAGS $FLAGS)
  3214. }
  3215. # tag:src-specific tag:cpp-specific tag:cpu
  3216. ### @usage: SRC_C_AVX512(File Flags...)
  3217. ###
  3218. ### Compile a single C/C++ file with AVX512 and additional Flags
  3219. macro SRC_C_AVX512(FILE, FLAGS...) {
  3220. _SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_AVX512 $FILE .avx512 $AVX512_CFLAGS $FLAGS)
  3221. }
  3222. # tag:src-specific tag:cpp-specific tag:cpu
  3223. ### @usage: SRC_C_AMX(File Flags...)
  3224. ###
  3225. ### Compile a single C/C++ file with AVX512 and additional Flags
  3226. macro SRC_C_AMX(FILE, FLAGS...) {
  3227. _SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_AMX $FILE .amx $AMX_CFLAGS $FLAGS)
  3228. }
  3229. # tag:src-specific tag:cpp-specific tag:cpu
  3230. ### @usage: SRC_C_XOP(File Flags...)
  3231. ###
  3232. ### Compile a single C/C++ file with (an AMD-specific instruction set,
  3233. ### see https://en.wikipedia.org/wiki/XOP_instruction_set) and additional Flags
  3234. macro SRC_C_XOP(FILE, FLAGS...) {
  3235. _SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_XOP $FILE .xop $XOP_CFLAGS $FLAGS)
  3236. }
  3237. # tag:src-specific tag:cpp-specific tag:cpu
  3238. ### @usage: SRC_C_PCLMUL(File Flags...)
  3239. ###
  3240. ### Compile a single C/C++ file with PCLMUL and additional Flags
  3241. macro SRC_C_PCLMUL(FILE, FLAGS...) {
  3242. _SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_PCLMUL $FILE .pclmul $PCLMUL_CFLAGS $FLAGS )
  3243. }
  3244. # tag:src-specific tag:cpp-specific
  3245. ### @usage: _SRC_STRICT_C_CPP(Ext MacroName File Flags...) # internal
  3246. ###
  3247. ### Defenition of generic macro. Report an error that the File with Ext is not
  3248. ### supported by macro MacroName if no appropriate macro specialization is found.
  3249. macro _SRC_STRICT_C_CPP(EXT, MACRO_NAME, FILE, FLAGS...) {
  3250. MESSAGE(FATAL_ERROR macro [[alt1]]$MACRO_NAME[[rst]] does not support files with [[imp]].$EXT[[rst]] extension)
  3251. }
  3252. # tag:src-specific tag:cpp-specific
  3253. ### @usage: _SRC_STRICT_C_CPP(Ext MacroName File Flags...) # internal
  3254. ###
  3255. ### Specialization of genreric macro _SRC_STRICT_C_CPP which compiles a single C file (with .c extension)
  3256. macro _SRC_STRICT_C_CPP("c", MACRO_NAME, FILE, FLAGS...) {
  3257. _SRC(c $FILE $FLAGS)
  3258. }
  3259. # tag:src-specific tag:cpp-specific
  3260. ### @usage: _SRC_STRICT_C_CPP(Ext MacroName File Flags...) # internal
  3261. ###
  3262. ### Specialization of genreric macro _SRC_STRICT_C_CPP which compiles a single Cpp file (with .cpp extension)
  3263. macro _SRC_STRICT_C_CPP("cpp", MACRO_NAME, FILE, FLAGS...) {
  3264. _SRC(cpp $FILE $FLAGS)
  3265. }
  3266. # tag:src-specific tag:cpp-specific
  3267. ### @usage: _SRC_STRICT_C_CPP(Ext MacroName File Flags...) # internal
  3268. ###
  3269. ### Specialization of genreric macro _SRC_STRICT_C_CPP which compiles a single Cpp file (with .cxx extension)
  3270. macro _SRC_STRICT_C_CPP("cxx", MACRO_NAME, FILE, FLAGS...) {
  3271. _SRC(cpp $FILE $FLAGS)
  3272. }
  3273. # tag:src-specific tag:cpp-specific
  3274. ### @usage: _SRC_STRICT_C_CPP(Ext MacroName File Flags...) # internal
  3275. ###
  3276. ### Specialization of genreric macro _SRC_STRICT_C_CPP which compiles a single Cpp file (with .cc extension)
  3277. macro _SRC_STRICT_C_CPP("cc", MACRO_NAME, FILE, FLAGS...) {
  3278. _SRC(cpp $FILE $FLAGS)
  3279. }
  3280. # tag:src-specific tag:cpp-specific
  3281. ### @usage: _SRC_STRICT_C_CPP(Ext MacroName File Flags...) # internal
  3282. ###
  3283. ### Specialization of genreric macro _SRC_STRICT_C_CPP which compiles a single Cpp file (with .C extension)
  3284. macro _SRC_STRICT_C_CPP("C", MACRO_NAME, FILE, FLAGS...) {
  3285. _SRC(cpp $FILE $FLAGS)
  3286. }
  3287. # tag:src-specific tag:cpp-specific
  3288. ### @usage: SRC_C_PIC(File Flags...)
  3289. ###
  3290. ### Compile a single C/C++ file with -fPIC and additional Flags
  3291. macro SRC_C_PIC(FILE, FLAGS...) {
  3292. _SRC_STRICT_C_CPP(${lastext:FILE} SRC_C_PIC $FILE $PIC_CFLAGS $FLAGS)
  3293. }
  3294. # tag:src-specific tag:cpp-specific
  3295. ### @usage: SRC_C_NO_LTO(File Flags...)
  3296. ###
  3297. ### Compile a single C/C++ file with link-time-optimization disabling and additional Flags
  3298. macro SRC_C_NO_LTO(FILE, FLAGS...) {
  3299. _SRC_STRICT_C_CPP(${lastext:FILE} SRC_C_NO_LTO $FILE $NO_LTO_CFLAGS $FLAGS)
  3300. }
  3301. # tag:python-processing tag:cython
  3302. # TODO: use it in [.pyx] cmd
  3303. ### @usage: BUILDWITH_CYTHON_CPP(Src Options...)
  3304. ###
  3305. ### Generates .cpp file from .pyx.
  3306. macro BUILDWITH_CYTHON_CPP(Src, Options...) {
  3307. .CMD=$RUN_CYTHON_SCRIPT $CYTHON_OPTIONS ${Options} --cplus ${CYTHON_CPP_OUTPUT_INCLUDES} ${pre=-I:_CYTHON__INCLUDE} ${input:Src} -o ${output;tobindir;suf=${OBJ_SUF}.cpp:Src} $CYTHON_OUTPUT_INCLUDES ${hide;kv:"p CY"} ${hide;kv:"pc yellow"}
  3308. .SEM=target_options-privates-ITEM && target_options-privates-option target_cython_sources && target_options-privates-args ${input:Src} ${hide;output;tobindir:Src.fake.o} && target_macroses-ITEM && target_macroses-macro target_cython_options && target_macroses-args $CYTHON_OPTIONS ${Options} --cplus ${CYTHON_CPP_OUTPUT_INCLUDES} && target_macroses-ITEM && target_macroses-macro target_cython_include_directories && target_macroses-args $_CYTHON__INCLUDE && target_macroses-ITEM && target_macroses-macro set_python_type_for_cython && target_macroses-args $PYTHON_TYPE_FOR_CYTHON
  3309. ADDINCL(FOR cython contrib/tools/cython/Cython/Includes)
  3310. }
  3311. # tag:python-processing tag:cython tag:internal
  3312. ### @usage: _BUILDWITH_CYTHON_CPP_DEP(Src Dep Options...) # internal
  3313. ###
  3314. ### Generates .cpp file from .pyx and attach extra input Dep.
  3315. ### If Dep changes the .cpp file will be re-generated.
  3316. macro _BUILDWITH_CYTHON_CPP_DEP(Src, Dep, Options...) {
  3317. .CMD=$RUN_CYTHON_SCRIPT $CYTHON_OPTIONS ${Options} --cplus ${CYTHON_CPP_OUTPUT_INCLUDES} ${pre=-I:_CYTHON__INCLUDE} ${input:Src} ${hide;input:Dep} -o ${output;tobindir;suf=${OBJ_SUF}.cpp:Src} $CYTHON_OUTPUT_INCLUDES ${hide;kv:"p CY"} ${hide;kv:"pc yellow"}
  3318. .SEM=target_options-privates-ITEM && target_options-privates-option target_cython_sources && target_options-privates-args ${input:Src} ${hide;input:Dep} ${hide;output;tobindir:Src.fake.o} && target_macroses-ITEM && target_macroses-macro target_cython_options && target_macroses-args $CYTHON_OPTIONS ${Options} --cplus ${CYTHON_CPP_OUTPUT_INCLUDES} && target_macroses-ITEM && target_macroses-macro target_cython_include_directories && target_macroses-args $_CYTHON__INCLUDE && target_macroses-ITEM && target_macroses-macro set_python_type_for_cython && target_macroses-args $PYTHON_TYPE_FOR_CYTHON
  3319. ADDINCL(FOR cython contrib/tools/cython/Cython/Includes)
  3320. }
  3321. # tag:python-processing tag:cython tag:internal
  3322. ### @usage: _BUILDWITH_CYTHON_CPP_H(Src Dep Options...) # internal
  3323. ###
  3324. ### BUILDWITH_CYTHON_CPP without .pyx infix and with cdef public .h file.
  3325. macro _BUILDWITH_CYTHON_CPP_H(Src, Dep, Options...) {
  3326. .CMD=$RUN_CYTHON_SCRIPT_H $CYTHON_OPTIONS ${Options} --cplus ${CYTHON_CPP_OUTPUT_INCLUDES} ${pre=-I:_CYTHON__INCLUDE} ${input:Src} ${hide;input:Dep} -o ${output;noext;tobindir:Src.cpp} ${hide;output;addincl;noext;tobindir:Src.h} ${hide;kv:"p CY"} ${hide;kv:"pc yellow"}
  3327. ADDINCL(FOR cython contrib/tools/cython/Cython/Includes)
  3328. }
  3329. # tag:python-processing tag:cython
  3330. ### @usage: BUILDWITH_CYTHON_C(Src Options...)
  3331. ###
  3332. ### Generates .c file from .pyx.
  3333. macro BUILDWITH_CYTHON_C(Src, Options...) {
  3334. .CMD=$RUN_CYTHON_SCRIPT $CYTHON_OPTIONS ${Options} ${pre=-I:_CYTHON__INCLUDE} ${input:Src} -o ${output;tobindir;suf=${OBJ_SUF}.c:Src} $CYTHON_OUTPUT_INCLUDES ${hide;kv:"p CY"} ${hide;kv:"pc yellow"}
  3335. .SEM=target_options-privates-ITEM && target_options-privates-option target_cython_sources && target_options-privates-args ${input:Src} ${hide;output;tobindir:Src.fake.o} && target_macroses-ITEM && target_macroses-macro target_cython_options && target_macroses-args $CYTHON_OPTIONS ${Options} ${CYTHON_OUTPUT_INCLUDES} && target_macroses-ITEM && target_macroses-macro target_cython_include_directories && target_macroses-args $_CYTHON__INCLUDE && target_macroses-ITEM && target_macroses-macro set_python_type_for_cython && target_macroses-args $PYTHON_TYPE_FOR_CYTHON
  3336. ADDINCL(FOR cython contrib/tools/cython/Cython/Includes)
  3337. }
  3338. # tag:python-processing tag:cython tag:internal
  3339. ### @usage: _BUILDWITH_CYTHON_C_DEP(Src Dep Options...) # internal
  3340. ###
  3341. ### Generates .c file from .pyx and attach extra input Dep.
  3342. ### If Dep changes the .c file will be re-generated.
  3343. macro _BUILDWITH_CYTHON_C_DEP(Src, Dep, Options...) {
  3344. .CMD=$RUN_CYTHON_SCRIPT $CYTHON_OPTIONS ${Options} ${pre=-I:_CYTHON__INCLUDE} ${input:Src} ${hide;input:Dep} -o ${output;tobindir;suf=${OBJ_SUF}.c:Src} $CYTHON_OUTPUT_INCLUDES ${hide;kv:"p CY"} ${hide;kv:"pc yellow"}
  3345. .SEM=target_options-privates-ITEM && target_options-privates-option target_cython_sources && target_options-privates-args ${input:Src} ${hide;input:Dep} ${hide;output;tobindir:Src.fake.o} && target_macroses-ITEM && target_macroses-macro target_cython_options && target_macroses-args $CYTHON_OPTIONS ${Options} ${CYTHON_OUTPUT_INCLUDES} && target_macroses-ITEM && target_macroses-macro target_cython_include_directories && target_macroses-args $_CYTHON__INCLUDE && target_macroses-ITEM && target_macroses-macro set_python_type_for_cython && target_macroses-args $PYTHON_TYPE_FOR_CYTHON
  3346. ADDINCL(FOR cython contrib/tools/cython/Cython/Includes)
  3347. }
  3348. # tag:python-processing tag:cython tag:internal
  3349. ### @usage: _BUILDWITH_CYTHON_C_H(Src Dep Options...) # internal
  3350. ###
  3351. ### BUILDWITH_CYTHON_C without .pyx infix and with cdef public .h file.
  3352. macro _BUILDWITH_CYTHON_C_H(Src, Dep, Options...) {
  3353. .CMD=$RUN_CYTHON_SCRIPT_H $CYTHON_OPTIONS ${Options} ${pre=-I:_CYTHON__INCLUDE} ${input:Src} ${hide;input:Dep} -o ${output;noext;tobindir:Src.c} ${hide;output;addincl;noext;tobindir:Src.h} $CYTHON_OUTPUT_INCLUDES ${hide;kv:"p CY"} ${hide;kv:"pc yellow"}
  3354. ADDINCL(FOR cython contrib/tools/cython/Cython/Includes)
  3355. }
  3356. # tag:python-processing tag:cython tag:internal
  3357. ### @usage: _BUILDWITH_CYTHON_C_API_H(Src Dep Options...) # internal
  3358. ###
  3359. ### BUILDWITH_CYTHON_C_H with cdef api _api.h file.
  3360. macro _BUILDWITH_CYTHON_C_API_H(Src, Dep, Options...) {
  3361. .CMD=$RUN_CYTHON_SCRIPT_H $CYTHON_OPTIONS ${Options} ${pre=-I:_CYTHON__INCLUDE} ${input:Src} ${hide;input:Dep} -o ${output;noext;tobindir:Src.c} ${hide;output;addincl;noext;tobindir:Src.h} ${hide;output;addincl;noext;defext=_api.h;tobindir:Src} $CYTHON_OUTPUT_INCLUDES ${hide;kv:"p CY"} ${hide;kv:"pc yellow"}
  3362. ADDINCL(FOR cython contrib/tools/cython/Cython/Includes)
  3363. }
  3364. ### @usage: BUILDWITH_RAGEL6(Src Options...)
  3365. ###
  3366. ### Compile .rl file using Ragel6.
  3367. macro BUILDWITH_RAGEL6(Src, Options...) {
  3368. .CMD=$RUN_NO_SANITIZE ${tool:"contrib/tools/ragel6"} $RAGEL6_FLAGS ${Options} -I${ARCADIA_ROOT} -o ${output;nopath;noext;defext=.rl6.cpp:Src} ${input:Src} ${hide;kv:"p R6"} ${hide;kv:"pc yellow"}
  3369. }
  3370. # tag:python-processing tag:internal
  3371. # TODO: use it in [.pyx] cmd
  3372. ### @usage: _PY_REGISTER() # internal
  3373. ###
  3374. ### Register Python 2.x module in internal resource file system. Arcadia Python 2.x importer will be retrieve these on import directive.
  3375. ###
  3376. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/pysrcs/#makrospyregister
  3377. macro _PY_REGISTER(Func) {
  3378. .CMD=$YMAKE_PYTHON ${input:"build/scripts/gen_py_reg.py"} $Func ${noauto;output:Func.reg.cpp} ${hide;kv:"p PY"} ${hide;kv:"pc yellow"}
  3379. SRCS(GLOBAL $Func.reg.cpp)
  3380. }
  3381. # tag:python-processing tag:internal
  3382. ### @usage: _PY3_REGISTER() # internal
  3383. ###
  3384. ### Register Python 3.x module in internal resource file system. Arcadia Python 3.x importer will be retrieve these on import directive
  3385. ###
  3386. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/pysrcs/#makrospyregister
  3387. macro _PY3_REGISTER(Func) {
  3388. .CMD=$YMAKE_PYTHON ${input:"build/scripts/gen_py3_reg.py"} $Func ${noauto;output:Func.reg3.cpp} ${hide;kv:"p PY"} ${hide;kv:"pc yellow"}
  3389. SRCS(GLOBAL $Func.reg3.cpp)
  3390. }
  3391. # tag:python-processing tag:internal
  3392. ### @usage: _PY_COMPILE_BYTECODE(SrcX Src) # internal
  3393. ###
  3394. ### Compile Python 2.x .py source file into Arcadia binary form suitable for PY2_PROGRAM
  3395. ###
  3396. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/pysrcs/#makrospyregister
  3397. macro _PY_COMPILE_BYTECODE(SrcX, Src, Dst) {
  3398. .CMD=$YMAKE_PYTHON ${input:"build/scripts/py_compile.py"} $SrcX ${input:Src} ${noauto;output:Dst.yapyc} ${hide;kv:"p PY"} ${hide;kv:"pc yellow"}
  3399. }
  3400. # tag:python-processing tag:internal
  3401. ### @usage: _PY3_COMPILE_BYTECODE(SrcX Src) # internal
  3402. ###
  3403. ### Compile Python 3.x .py source file into Arcadia binary form suitable for PY3_PROGRAM
  3404. ###
  3405. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/pysrcs/#makrospyregister
  3406. macro _PY3_COMPILE_BYTECODE(SrcX, Src, Dst) {
  3407. .CMD=${env:"PYTHONHASHSEED=0"} ${tool:"tools/py3cc"} $SrcX ${input:Src} ${noauto;output:Dst.yapyc3} ${hide;kv:"p PY"} ${hide;kv:"pc yellow"}
  3408. }
  3409. macro _ARCHIVE_SEM_HELPER(FLAGS[], OUT, Files...) {
  3410. .SEM=custom_runs-ITEM && custom_runs-outputs ${OUT} && custom_runs-depends $ARCH_TOOL ${join= :Files} && custom_runs-command $ARCH_TOOL $FLAGS ${join=\: :Files}: -o ${OUT}
  3411. }
  3412. ### @usage: ARCHIVE_ASM(NAME archive_name files...)
  3413. ###
  3414. ### Similar to the macro ARCHIVE, but:
  3415. ### 1. works faster and it is better to use for large files.
  3416. ### 2. Different syntax (see examples in codesearch or users/pg/tests/archive_test)
  3417. macro ARCHIVE_ASM(NAME="", DONTCOMPRESS?"-p":"", Files...) {
  3418. .CMD=$ARCH_TOOL -q $DONTCOMPRESS ${input;join=\: :Files}: -o ${output;suf=$OBJ_SUF.rodata:NAME} ${hide;kv:"p AR"} ${hide;kv:"pc light-cyan"}
  3419. .SEM=$_ARCHIVE_SEM_HELPER(${output;suf=$OBJ_SUF.rodata:NAME} ${input:Files} FLAGS -q $DONTCOMPRESS)
  3420. }
  3421. # tag:yweb-specific
  3422. macro PIRE_INLINE_CMD(SRC) {
  3423. .CMD=${tool:"library/cpp/regex/pire/inline"} -o ${output:SRC} ${input:SRC} ${hide;output_include:SRC} ${hide;kv:"p PI"} ${hide;kv:"pc yellow"}
  3424. }
  3425. # tag:yweb-specific
  3426. macro PIRE_INLINE(FILES...) {
  3427. foreach (FILE : $FILES) {
  3428. PIRE_INLINE_CMD($FILE)
  3429. }
  3430. }
  3431. ### @usage: ARCHIVE(archive_name [DONT_COMPRESS] files...)
  3432. ###
  3433. ### Add arbitrary data to a modules. Unlike RESOURCE macro the result should be futher processed by othet macros in the module.
  3434. ###
  3435. ### Example: https://wiki.yandex-team.ru/yatool/howtowriteyamakefiles/#a1ispolzujjtekomanduarchive
  3436. macro ARCHIVE(NAME="", DONTCOMPRESS?"-p":"", Files...) {
  3437. .CMD=$ARCH_TOOL -q -x $DONTCOMPRESS ${input;join=\: :Files}: -o ${output;addincl;noauto:NAME} ${hide;kv:"p AR"} ${hide;kv:"pc light-red"}
  3438. .SEM=$_ARCHIVE_SEM_HELPER(${output;addincl;noauto:NAME} ${input:Files} FLAGS -q -x $DONTCOMPRESS) && target_options-privates-ITEM && target_options-privates-option target_sources && target_options-privates-args $BINDIR/$NAME
  3439. }
  3440. ### @usage: ARCHIVE_BY_KEYS(archive_name key [DONT_COMPRESS] files...)
  3441. ###
  3442. ### Add arbitrary data to a module be accessible by specified key.
  3443. ### Unlike RESOURCE macro the result should be futher processed by othet macros in the module.
  3444. ###
  3445. ### Example: https://wiki.yandex-team.ru/yatool/howtowriteyamakefiles/#a1ispolzujjtekomanduarchive
  3446. macro ARCHIVE_BY_KEYS(NAME="", KEYS="", DONTCOMPRESS?"-p":"", Files...) {
  3447. .CMD=$ARCH_TOOL -q -x $DONTCOMPRESS ${input:Files} -k $KEYS -o ${output;addincl;noauto:NAME} ${hide;kv:"p AR"} ${hide;kv:"pc light-red"}
  3448. }
  3449. #scripts
  3450. #special commands
  3451. BUILDVERSION_SCRIPT=build/scripts/build_info_gen.py
  3452. SVNVERSION_JAVA_MARKER=output-java-class
  3453. SVNVERSION_GO_MARKER=output-go
  3454. VCS_C_OBJ=$BINDIR/__vcs_version__.c$OBJECT_SUF
  3455. VCS_C_OBJ_RR=$MODDIR/__vcs_version__.c$OBJECT_SUF
  3456. VCS_C=$BINDIR/__vcs_version__.c
  3457. VCS_GO=$BINDIR/__vcs_version__.go
  3458. VCS_JAVA=$BINDIR/__vcs_version__.mf
  3459. VCS_INFO_DISABLE_CACHE__NO_UID__=
  3460. YASM_DEBUG_INFO_DISABLE_CACHE__NO_UID__=
  3461. CL_DEBUG_INFO_DISABLE_CACHE__NO_UID__=
  3462. CL_MACRO_INFO_DISABLE_CACHE__NO_UID__=
  3463. YASM_DEBUG_INFO=
  3464. CL_DEBUG_INFO=
  3465. CL_MACRO_INFO=
  3466. when ($FORCE_VCS_INFO_UPDATE == "yes") {
  3467. VCS_INFO_DISABLE_CACHE__NO_UID__=${hide;kv:"disable_cache"}
  3468. }
  3469. ### Works for pyton too.
  3470. GENERATE_VCS_C_INFO_NODEP=$YMAKE_PYTHON3 ${input:"build/scripts/vcs_info.py"} $(VCS)/vcs.json $VCS_C ${input:"build/scripts/c_templates/svn_interface.c"} $VCS_INFO_DISABLE_CACHE__NO_UID__ && $_SRC_c_nodeps($VCS_C $VCS_C_OBJ $(SOURCE_ROOT))
  3471. GENERATE_VCS_GO_INFO_NODEP=$YMAKE_PYTHON3 ${input:"build/scripts/vcs_info.py"} output-go $(VCS)/vcs.json $VCS_GO $GO_ARCADIA_PROJECT_PREFIX $VCS_INFO_DISABLE_CACHE__NO_UID__
  3472. GENERATE_VCS_JAVA_INFO_NODEP=$YMAKE_PYTHON3 ${input:"build/scripts/vcs_info.py"} output-java $(VCS)/vcs.json $VCS_JAVA $VCS_INFO_DISABLE_CACHE__NO_UID__
  3473. macro UPDATE_VCS_JAVA_INFO_NODEP(Jar) {
  3474. .CMD=$YMAKE_PYTHON3 ${input:"build/scripts/vcs_info.py"} output-java $(VCS)/vcs.json $VCS_JAVA $Jar $VCS_INFO_DISABLE_CACHE__NO_UID__
  3475. }
  3476. VCS_INFO_FILE=
  3477. ### @usage: VCS_INFO_FILE([FILE out_file])
  3478. ###
  3479. ### Enable saving vcs info as a json-file into PACKAGE
  3480. ###
  3481. ### Info is saved to 'vcs_info.json' by default.
  3482. ### Use FILE parameter if you want another name.
  3483. ###
  3484. ### Note: macro can be used only once per module
  3485. macro VCS_INFO_FILE(FILE="vcs_info.json") {
  3486. SET(VCS_INFO_FILE $FILE)
  3487. }
  3488. ADD_VCS_INFO_FILE_CMD=
  3489. when ($VCS_INFO_FILE) {
  3490. ADD_VCS_INFO_FILE_CMD=$YMAKE_PYTHON3 ${input:"build/scripts/vcs_info.py"} output-json $(VCS)/vcs.json ${output:VCS_INFO_FILE} $VCS_INFO_DISABLE_CACHE__NO_UID__
  3491. }
  3492. ### @usage: CREATE_BUILDINFO_FOR(GenHdr)
  3493. ###
  3494. ### Creates header file to access some information about build specified via configuration variables.
  3495. ### Unlike CREATE_SVNVERSION_FOR() it doesn't take revion information from VCS, it uses revision and SandboxTaskId passed via -D options to ya make
  3496. macro CREATE_BUILDINFO_FOR(GenHdr) {
  3497. .CMD=$YIELD $CXX_COMPILER && $YIELD $CXXFLAGS && $XARGS $YMAKE_PYTHON3 ${input:BUILDVERSION_SCRIPT} ${output:GenHdr} ${hide;kv:"p BI"} ${hide;kv:"pc yellow"} ${hide;kv:"show_out"} $SVN_DEPENDS_CACHE__NO_UID__
  3498. .SEM=$RUN_PYTHON3($BUILDVERSION_SCRIPT $GenHdr \\\"${CMAKE_CXX_COMPILER}\\\" \\\"${CMAKE_CXX_FLAGS}\\\" OUT $GenHdr)
  3499. .STRUCT_CMD=yes
  3500. }
  3501. DECIMAL_MD5_SCRIPT=build/scripts/decimal_md5.py
  3502. DECIMAL_MD5_FIXED=
  3503. ### @usage: DECIMAL_MD5_LOWER_32_BITS(<fileName> [FUNCNAME funcName] [inputs...])
  3504. ###
  3505. ### Generates .cpp file <fileName> with one defined function 'const char* <funcName>() { return "<calculated_md5_hash>"; }'.
  3506. ### <calculated_md5_hash> will be md5 hash for all inputs passed to this macro.
  3507. macro DECIMAL_MD5_LOWER_32_BITS(File, FUNCNAME="", Opts...) {
  3508. .CMD=$YMAKE_PYTHON ${input:DECIMAL_MD5_SCRIPT} --fixed-output=${DECIMAL_MD5_FIXED} --func-name=${FUNCNAME} --lower-bits 32 --source-root=$ARCADIA_ROOT ${context=TEXT;input:Opts} ${stdout;output:File} ${hide;kv:"p SV"} ${hide;kv:"pc yellow"} ${hide;kv:"show_out"}
  3509. }
  3510. # tag:internal
  3511. ### @usage: CFG_VARS # internal
  3512. ###
  3513. ### Mark commands that embed Configuration variables into files
  3514. macro CFG_VARS() {
  3515. .GEN_FROM_FILE=yes
  3516. }
  3517. ### @usage: CONFIGURE_FILE(from to)
  3518. ###
  3519. ### Copy file with the replacement of configuration variables in form of @ANY_CONF_VAR@ with their values.
  3520. ### The values are collected during configure stage, while replacement itself happens during build stage.
  3521. ### Used implicitly for .in-files processing.
  3522. macro CONFIGURE_FILE(Src, Dst) {
  3523. .CMD=$YMAKE_PYTHON ${input:"build/scripts/configure_file.py"} ${input:Src} ${output;addincl:Dst} $CFG_VARS ${hide;kv:"p CF"} ${hide;kv:"pc yellow"}
  3524. .SEM=dir_macroses-ITEM && dir_macroses-macro set_vars && dir_macroses-args ${CFG_VARS} && target_commands-ITEM && target_commands-macro configure_file && target_commands-args $S/${input;rootrel:Src} $B/${output;addincl;rootrel:Dst}
  3525. }
  3526. # tag:flags
  3527. ### @usage: LDFLAGS(LinkerFlags...)
  3528. ###
  3529. ### Add flags to the link command line of executable or shared library/dll.
  3530. ### Note: LDFLAGS are always global. When set in the LIBRARY module they will affect all programs/dlls/tests the library is linked into.
  3531. ### Note: remember about the incompatibility of flags for gcc and cl.
  3532. macro LDFLAGS(Flags...) {
  3533. SET_APPEND(LDFLAGS_GLOBAL $Flags)
  3534. }
  3535. # tag:flags
  3536. ### @usage: CFLAGS([GLOBAL compiler_flag]* compiler_flags)
  3537. ###
  3538. ### Add the specified flags to the compilation command of C and C++ files.
  3539. ### @params: GLOBAL - Propagates these flags to dependent projects
  3540. ### Bear in mind that certain flags might be incompatible with certain compilers.
  3541. macro CFLAGS(Flags...) {
  3542. SET_APPEND_WITH_GLOBAL(USER_CFLAGS $Flags)
  3543. }
  3544. # tag:flags
  3545. ### @usage: GLOBAL_CFLAGS(compiler_flags)
  3546. ###
  3547. ### Add the specified flags to the compilation command of C and C++ files and propagate these flags to dependent projects
  3548. macro GLOBAL_CFLAGS(Flags...) {
  3549. SET_APPEND_WITH_GLOBAL(USER_CFLAGS ${pre=GLOBAL :Flags})
  3550. }
  3551. # tag:flags
  3552. ### @usage: MASMFLAGS(compiler flags)
  3553. ### Add the specified flags to the compilation command of .masm files.
  3554. macro MASMFLAGS(Flags...) {
  3555. SET_APPEND(MASMFLAGS $Flags)
  3556. }
  3557. # tag:flags
  3558. ### @usage: CONLYFLAGS([GLOBAL compiler_flag]* compiler_flags)
  3559. ### Add the specified flags to the compilation command of .c (but not .cpp) files.
  3560. ### @params: GLOBAL - Distributes these flags on dependent projects
  3561. macro CONLYFLAGS(Flags...) {
  3562. SET_APPEND_WITH_GLOBAL(USER_CONLYFLAGS $Flags)
  3563. }
  3564. # tag:flags
  3565. ### @usage: CXXFLAGS(compiler_flags)
  3566. ### Add the specified flags to the compilation command of .cpp (but not .c) files.
  3567. macro CXXFLAGS(Flags...) {
  3568. SET_APPEND_WITH_GLOBAL(USER_CXXFLAGS $Flags)
  3569. }
  3570. # tag:flags
  3571. ### @usage: CUDA_NVCC_FLAGS(compiler flags)
  3572. ### Add the specified flags to the compile line .cu-files.
  3573. macro CUDA_NVCC_FLAGS(Flags...) {
  3574. SET_APPEND(CUDA_NVCC_FLAGS $Flags)
  3575. }
  3576. CUDA_DEVICE_LINK_LIBRARY_CMD=$NVCC_OLD $NVCC_FLAGS -o ${output;suf=${OBJ_SUF}${NVCC_OBJ_EXT}:"devlink"} -dlink ${input:_NVCC_DEVICE_SRCS} -I$CUDA_TARGET_ROOT/include --compiler-options ${join= :C_FLAGS_PLATFORM} $NVCC_ENV ${hide;kv:"p DL"} ${hide;kv:"pc light-blue"} && $LINK_LIB
  3577. ### @usage: CUDA_DEVICE_LINK_LIBRARY()
  3578. ###
  3579. ### The LIBRARY() module with an additional step with CUDA device linking.
  3580. ### Use [NVCC_DEVICE_LINK](#macro_NVCC_DEVICE_LINK) macro to specify sources for device link.
  3581. module CUDA_DEVICE_LINK_LIBRARY: LIBRARY {
  3582. SET(_LD_LINK_LIB_EXTRA_INPUT ${output;suf=${OBJ_SUF}${NVCC_OBJ_EXT}:"devlink"})
  3583. .CMD=$CUDA_DEVICE_LINK_LIBRARY_CMD
  3584. }
  3585. # tag:flags
  3586. ### @usage: NVCC_DEVICE_LINK(file.cu...)
  3587. ### Run nvcc --device-link on objects compiled from srcs with --device-c.
  3588. ### This generates a stub object devlink.o that supplies missing pieces for the
  3589. ### host linker to link relocatable device objects into the final executable.
  3590. ### This macro can be used only with [CUDA_DEVICE_LINK_LIBRARY](#module_CUDA_DEVICE_LINK_LIBRARY) module.
  3591. macro NVCC_DEVICE_LINK(Srcs...) {
  3592. SET_APPEND(_NVCC_DEVICE_SRCS ${suf=${OBJ_SUF}${NVCC_OBJ_EXT}:Srcs})
  3593. .PEERDIR=build/platform/cuda
  3594. }
  3595. # tag:flags
  3596. ### @usage: CYTHON_FLAGS(compiler_flags)
  3597. ### Add the specified flags to the compilation command of .pyx files.
  3598. macro CYTHON_FLAGS(Flags...) {
  3599. SET_APPEND(CYTHON_OPTIONS $Flags)
  3600. }
  3601. ### @usage: STRIP()
  3602. ### Strip debug info from a PROGRAM, DLL or TEST.
  3603. ### This macro doesn't work in LIBRARY's, UNION's and PACKAGE's.
  3604. macro STRIP() {
  3605. ENABLE(STRIP)
  3606. }
  3607. ### @usage: NO_OPTIMIZE()
  3608. ### Build code without any optimizations (-O0 mode).
  3609. macro NO_OPTIMIZE() {
  3610. ENABLE(NO_OPTIMIZE)
  3611. }
  3612. #TODO(YMAKE-91) read proper compile flags instead of sending explicit flags to semgraph directly
  3613. _SEM_EXTRA_CXX_FLAGS=
  3614. ### @usage: NO_COMPILER_WARNINGS()
  3615. ### Disable all compiler warnings in the module.
  3616. macro NO_COMPILER_WARNINGS() {
  3617. ENABLE(NO_COMPILER_WARNINGS)
  3618. SET(_SEM_EXTRA_CXX_FLAGS "$<IF:$<CXX_COMPILER_ID:MSVC>,,-Wno-everything>")
  3619. }
  3620. ### @usage: NO_WSHADOW()
  3621. ### Disable C++ shadowing warnings.
  3622. macro NO_WSHADOW() {
  3623. ENABLE(NO_WSHADOW)
  3624. }
  3625. # tag:internal
  3626. ### @usage: NO_PLATFORM_RESOURCES() # internal
  3627. ### Exclude dependency on platform resources libraries.
  3628. ### Most probably you'll never need this. If you think you need, please contact devtools@ for assistance.
  3629. macro NO_PLATFORM_RESOURCES() {
  3630. ENABLE(NOPLATFORM_RESOURCES)
  3631. }
  3632. # tag:internal tag:codenav
  3633. ### @usage: NO_CODENAVIGATION() # internal
  3634. ### Disable codenaviagtion for a module. Needed to avoid PEERDIR loops in codenavigation support.
  3635. ### Most probably you'll never need this. If you think you need, please contact devtools@ for assistance.
  3636. macro NO_CODENAVIGATION() {
  3637. ENABLE(NOCODENAVIGATION)
  3638. }
  3639. ### @usage: NO_UTIL()
  3640. ### Build module without dependency on util.
  3641. ### Note: use this with care. Util most likely will be linked into executable anyway,
  3642. ### so using util headers/functions/classes may not be detected at build time and may lead to unpredictable behavors at configure time.
  3643. macro NO_UTIL() {
  3644. ENABLE(NOUTIL)
  3645. }
  3646. ### @usage: NO_RUNTIME()
  3647. ###
  3648. ### This macro:
  3649. ### 1. Sets the ENABLE(NOUTIL) + DISABLE(USE_INTERNAL_STL);
  3650. ### 2. If the project that contains the macro NO_RUNTIME(), peerdir-it project does not contain NO_RUNTIME() => Warning.
  3651. ### Note: use this with care. Arcadia STL most likely will be linked into executable anyway, so using STL headers/functions/classes
  3652. ### may not be detected at build time and may lead to unpredictable behavors at configure time.
  3653. macro NO_RUNTIME() {
  3654. SET(USE_ARCADIA_LIBM no)
  3655. NO_UTIL()
  3656. ENABLE(NORUNTIME)
  3657. }
  3658. ### @usage: NO_LIBC()
  3659. ###
  3660. ### Exclude dependencies on C++ and C runtimes (including util, musl and libeatmydata).
  3661. ### Note: use this with care. libc most likely will be linked into executable anyway,
  3662. ### so using libc headers/functions may not be detected at build time and may lead to unpredictable behavors at configure time.
  3663. macro NO_LIBC() {
  3664. NO_RUNTIME()
  3665. DISABLE(MUSL)
  3666. ENABLE(NOLIBC)
  3667. }
  3668. ### @usage: NO_PLATFORM()
  3669. ###
  3670. ### Exclude dependencies on C++ and C runtimes (including util, musl and libeatmydata) and set NO_PLATFORM variable for special processing.
  3671. ### Note: use this with care. libc most likely will be linked into executable anyway,
  3672. ### so using libc headers/functions may not be detected at build time and may lead to unpredictable behavors at configure time.
  3673. macro NO_PLATFORM() {
  3674. NO_LIBC()
  3675. ENABLE(NOPLATFORM)
  3676. }
  3677. # tag:cpp-specific
  3678. ### @usage: USE_CXX()
  3679. ###
  3680. ### Add dependency on C++ runtime
  3681. ### Note: This macro is inteneded for use in _GO_BASE_UNIT like module when the module is built without C++ runtime by default
  3682. macro USE_CXX() {
  3683. DISABLE(NORUNTIME)
  3684. }
  3685. ### @usage: USE_UTIL()
  3686. ###
  3687. ### Add dependency on util and C++ runtime
  3688. ### Note: This macro is intended for use in _GO_BASE_UNIT like module when the module is build without util by default
  3689. macro USE_UTIL() {
  3690. USE_CXX()
  3691. DISABLE(NOUTIL)
  3692. }
  3693. ### @usage: USE_NASM()
  3694. ###
  3695. ### Build only .asm files with nasm toolchain instead of yasm
  3696. ### Add to ya.make file ADDINCL(asm ...) with all folders where .asm files include smth
  3697. macro USE_NASM() {
  3698. ENABLE(USE_NASM_ASSEMBLER)
  3699. PEERDIR(build/external_resources/nasm)
  3700. }
  3701. # tag:deprecated
  3702. ### @usage: NO_JOIN_SRC() # deprecated, does-nothing
  3703. ### This macro currently does nothing. This is default behavior which cannot be overridden at module level.
  3704. macro NO_JOIN_SRC() {
  3705. ENABLE(UNUSED_MACRO)
  3706. }
  3707. # tag:sanitize
  3708. ### @usage: NO_SANITIZE()
  3709. ###
  3710. ### Disable all sanitizers for the module.
  3711. macro NO_SANITIZE() {
  3712. DISABLE(SANITIZER_TYPE)
  3713. }
  3714. # tag:coverage tag:sanitize
  3715. ### @usage: NO_SANITIZE_COVERAGE()
  3716. ###
  3717. ### Disable lightweight coverage (-fsanitize-coverage) for the module.
  3718. ### Sanitize coverage is commonly used with fuzzing.
  3719. ### It might be useful to disable it for libraries that should never
  3720. ### be the main targets for fuzzing, like libfuzzer library itself.
  3721. ### Sanitize coverage instrumentation is enabled by the --sanitize-coverage option.
  3722. macro NO_SANITIZE_COVERAGE() {
  3723. DISABLE(SANITIZE_COVERAGE)
  3724. }
  3725. # tag:coverage
  3726. ### @usage: NO_CLANG_COVERAGE()
  3727. ###
  3728. ### Disable heavyweight clang coverage for the module. Clang coverage instrumentation is enabled by the --clang-coverage option.
  3729. macro NO_CLANG_COVERAGE() {
  3730. DISABLE(CLANG_COVERAGE)
  3731. }
  3732. # tag:coverage
  3733. ### @usage: NO_PROFILE_RUNTIME()
  3734. ###
  3735. ### Never link this target with profile runtime. Only should be used for very basic build tools
  3736. macro NO_PROFILE_RUNTIME() {
  3737. DISABLE(NEED_PROFILE_RUNTIME)
  3738. }
  3739. macro NO_CLANG_TIDY() {
  3740. DISABLE(TIDY_ENABLED)
  3741. }
  3742. # tag:lua-specific
  3743. LUAJIT_PATH=${ARCADIA_ROOT}/contrib/libs/luajit
  3744. macro _LUAJIT_OBJDUMP(Src, OUT="") {
  3745. .CMD=${cwd:LUAJIT_PATH} ${tool:"contrib/libs/luajit/compiler"} -b -g ${input:Src} ${noauto;output:OUT} ${hide;kv:"p LJ"} ${hide;kv:"pc light-cyan"}
  3746. }
  3747. # tag:lua-specific
  3748. LUAJIT_21_PATH=${ARCADIA_ROOT}/contrib/libs/luajit_21
  3749. macro _LUAJIT_21_OBJDUMP(Src, OUT="") {
  3750. .CMD=${cwd:LUAJIT_21_PATH} ${tool:"contrib/libs/luajit_21/compiler"} -b -g ${input:Src} ${noauto;output:OUT} ${hide;kv:"p LJ"} ${hide;kv:"pc light-cyan"}
  3751. }
  3752. # tag:lua-specific
  3753. LUAJIT_OPENRESTY_PATH=${ARCADIA_ROOT}/contrib/libs/luajit_openresty
  3754. macro _LUAJIT_OPENRESTY_OBJDUMP(Src, OUT="") {
  3755. .CMD=${cwd:LUAJIT_OPENRESTY_PATH} ${tool:"contrib/libs/luajit_openresty/compiler"} -b -g ${input:Src} ${noauto;output:OUT} ${hide;kv:"p LJ"} ${hide;kv:"pc light-cyan"}
  3756. }
  3757. ### @usage: GENERATE_ENUM_SERIALIZATION(File.h)
  3758. ###
  3759. ### Create serialization support for enumeration members defined in the header (String <-> Enum conversions) and compile it into the module.
  3760. ###
  3761. ### Documentation: https://wiki.yandex-team.ru/yatool/HowToWriteYaMakeFiles/
  3762. macro GENERATE_ENUM_SERIALIZATION(File) {
  3763. .CMD=$ENUM_PARSER_TOOL ${input:File} --include-path ${input;rootrel:File} --output ${output;suf=_serialized.cpp:File} ${output_include;from_input;hide:File} ${hide;output_include:"util/generic/serialized_enum.h"} ${hide;kv:"p EN"} ${hide;kv:"pc yellow"}
  3764. .SEM=target_macroses-ITEM && target_macroses-macro generate_enum_serilization && target_macroses-args ${input:File} ${hide;output;suf=_serialized.o:File} INCLUDE_HEADERS ${input;rootrel:File} ${hide;tool:"tools/enum_parser/enum_parser"}
  3765. PEERDIR(tools/enum_parser/enum_serialization_runtime)
  3766. }
  3767. ### @usage: GENERATE_ENUM_SERIALIZATION_WITH_HEADER(File.h)
  3768. ###
  3769. ### Create serialization support for enumeration members defined in the header (String <-> Enum conversions) and compile it into the module
  3770. ### Provide access to serialization functions via generated header File_serialized.h
  3771. ###
  3772. ### Documentation: https://wiki.yandex-team.ru/yatool/HowToWriteYaMakeFiles/
  3773. macro GENERATE_ENUM_SERIALIZATION_WITH_HEADER(File) {
  3774. .CMD=$ENUM_PARSER_TOOL ${input:File} --include-path ${input;rootrel:File} --output ${output;suf=_serialized.cpp:File} --header ${output;suf=_serialized.h:File} ${output_include;from_input;hide:File} ${hide;kv:"p EN"} ${hide;kv:"pc yellow"}
  3775. .SEM=target_macroses-ITEM && target_macroses-macro generate_enum_serilization && target_macroses-args ${input:File} ${hide;output;suf=_serialized.o:File} GEN_HEADER ${output;suf=_serialized.h:File} INCLUDE_HEADERS ${input;rootrel:File} ${hide;tool:"tools/enum_parser/enum_parser"}
  3776. PEERDIR(tools/enum_parser/enum_serialization_runtime)
  3777. }
  3778. ### @usage: DEB_VERSION(File)
  3779. ###
  3780. ### Creates a header file DebianVersion.h define the DEBIAN_VERSION taken from the File.
  3781. macro DEB_VERSION(File) {
  3782. .CMD=$YMAKE_PYTHON ${input:"build/scripts/mkver.py"} ${input:File} ${stdout;output:"DebianVersion.h"} ${hide;kv:"p CL"} ${hide;kv:"pc yellow"}
  3783. }
  3784. ### @usage: NEED_CHECK()
  3785. ###
  3786. ### Commits to the project marked with this macro will be blocked by pre-commit check and then will be
  3787. ### automatically merged to trunk only if there is no new broken build targets in check results.
  3788. ### The use of this macro is disabled by default.
  3789. macro NEED_CHECK(Flags...) {
  3790. # TODO: FIXME
  3791. ENABLE(UNUSED_MACRO)
  3792. }
  3793. # tag:deprecated
  3794. ### @usage: NO_NEED_CHECK() # deprecated
  3795. ###
  3796. ### Commits to the project marked with this macro will not be affected by higher-level NEED_CHECK macro.
  3797. macro NO_NEED_CHECK(Flags...) {
  3798. ENABLE(UNUSED_MACRO)
  3799. }
  3800. # tag:deprecated
  3801. ### @usage: NEED_REVIEW() # deprecated
  3802. ###
  3803. ### Mark the project as needing review.
  3804. ### Reviewers are listed in the macro OWNER. The use of this macro is disabled by default.
  3805. ### Details can be found here: https://clubs.at.yandex-team.ru/arcadia/6104
  3806. macro NEED_REVIEW(Flags...) {
  3807. # TODO: FIXME
  3808. ENABLE(UNUSED_MACRO)
  3809. }
  3810. ### @usage: SUBSCRIBER(UsersOrGroups)
  3811. ###
  3812. ### Add observers of the code.
  3813. ### In the SUBSCRIBER macro you can use:
  3814. ### 1. login-s from staff.yandex-team.ru
  3815. ### 2. Review group (to specify the Code-review group need to use the prefix g:)
  3816. ###
  3817. ### Note: currently SUBSCRIBER is read only by Arcanum and is not processed by
  3818. ### the build system. It's planned to be phased out in favor of subcription via a.yaml
  3819. macro SUBSCRIBER(Subscribers...) {
  3820. ENABLE(UNUSED_MACRO)
  3821. }
  3822. MODVER=unknown
  3823. ### @usage: VERSION(Args...)
  3824. ###
  3825. ### Specify version of a module. Currently unused by build system, only informative.
  3826. macro VERSION(Flags...) {
  3827. SET(MODVER ${Flags})
  3828. }
  3829. DATAWORK_SCHEEME_EXPORT_FLAGS=
  3830. when ($UNIX == "yes") {
  3831. SCHEEME2_CFLAGS= -E -x c++
  3832. }
  3833. when ($WIN32 == "yes") {
  3834. SCHEEME2_CFLAGS= /E /TP
  3835. }
  3836. SCHEEME2_STRUCT_INFO_FLAGS=-f "const static ui32 RecordSig" -u "RecordSig" --gcc44_no_typename --no_complex_overloaded_func_export
  3837. ### @usage: GEN_SCHEEME2(scheeme_name from_file dependent_files...)
  3838. ###
  3839. ### Generates a C++ description for structure(contains the field RecordSig) in the specified file (and connected).
  3840. ###
  3841. ### 1. ${scheeme_name}.inc - the name of the generated file.
  3842. ### 2. Use an environment variable - DATAWORK_SCHEEME_EXPORT_FLAGS that allows to specify flags to tools/structparser
  3843. ###
  3844. ### @example:
  3845. ###
  3846. ### SET(DATAWORK_SCHEEME_EXPORT_FLAGS --final_only -m "::")
  3847. ###
  3848. ### all options are passed to structparser (in this example --final_only - do not export heirs with public base that contains the required field,,- m "::" only from the root namespace)
  3849. ### sets in extra option
  3850. ###
  3851. ### @example:
  3852. ###
  3853. ### SET(EXTRACT_STRUCT_INFO_FLAGS -f \"const static ui32 RecordSig\"
  3854. ### -u \"RecordSig\" -n${scheeme_name}SchemeInfo ----gcc44_no_typename no_complex_overloaded_func_export
  3855. ### ${DATAWORK_SCHEEME_EXPORT_FLAGS})
  3856. ###
  3857. ### for compatibility with C++ compiler and the external environment.
  3858. ### See tools/structparser for more details.
  3859. macro GEN_SCHEEME2(ScheemeName, FromFile) {
  3860. .CMD=$CXX_COMPILER_OLD $C_FLAGS_PLATFORM -c ${stdout;tmp:FromFile.cph} $SCHEEME2_CFLAGS ${input:FromFile} ${pre=-I:_C__INCLUDE} $CXXFLAGS -Wno-error && ${tool:"tools/structparser"} -o ${output:ScheemeName.inc} -n N${ScheemeName}SchemeInfo $SCHEEME2_STRUCT_INFO_FLAGS $DATAWORK_SCHEEME_EXPORT_FLAGS ${tmp:FromFile.cph} ${stdout;noauto;output:ScheemeName.inc.log} ${hide;kv:"p SH"} ${hide;kv:"pc yellow"}
  3861. }
  3862. ### @usage: SYMLINK(from to)
  3863. ### Add symlink
  3864. macro SYMLINK(From, To) {
  3865. .CMD=$YMAKE_PYTHON ${input:"build/scripts/symlink.py"} ${input;dirallowed:From} ${noauto;output:To} ${hide;kv:"p LN"} ${hide;kv:"pc light-cyan"}
  3866. }
  3867. macro _FMT_INDUCED_DEPS(For, Deps...) {
  3868. .CMD=${induced_deps=$For;hide:Deps}
  3869. }
  3870. ### @usage: PREPARE_INDUCED_DEPS(VAR Type Files...)
  3871. ###
  3872. ### Format value for `INDUCED_DEPS` param in certain macros and assign to `VAR`
  3873. ### This tells that files of Type resulted from code generation macros (not neccessarily directly,
  3874. ### but in processing chain of generated files) should have extra dependencies from list of Files...
  3875. ###
  3876. ### Prominent example here is Cython: one can generate .pyx file that may depend on .pxd and have cimpot from
  3877. ### certain .h. The former is dependency for .pyx itself, while the latter is dependency for .pyx.cpp
  3878. ### resulted from Cython-processing of generated pyx. The code ganeration will look like:
  3879. ### ```
  3880. ### PREPARE_INDUCED_DEPS(PYX_DEPS pyx imported.pxd)
  3881. ### PREPARE_INDUCED_DEPS(CPP_DEPS cpp cdefed.h)
  3882. ### RUN_PYTHON3(generate_pyx.py genereted.pyx OUT generated.pyx INDUCED_DEPS $PYX_DEPS $CPP_DEPS)
  3883. ### ```
  3884. ###
  3885. ### The VAR will basically contain pair of `Type:[Files...]` in a form suitable for passing
  3886. ### as an element of array parameter. This is needed because language of ya.make doesn't support
  3887. ### Dict params right now and so it is impossible to directly pass something
  3888. ### like `{Type1:[Files2...], Type2:[Files2...]}`
  3889. ###
  3890. macro PREPARE_INDUCED_DEPS(VAR, For, Deps...) {
  3891. SET($VAR \$_FMT_INDUCED_DEPS($For $Deps))
  3892. }
  3893. ### Helper macro for DECLARE_IN_DIRS to add proper '/' to non-empty SRCDIR and form proper EXCLUDES
  3894. macro _DECL_IN_DIR_GLOB(var_prefix, pattern, rec_part, SRCDIR="", EXCLBASE="", EXCLUDES[], DIRS[], DUMMY[]) {
  3895. _PATTERN=${pre=${SRCDIR};suf=/${rec_part}${pattern}:DIRS}
  3896. _EXCLUDES=${EXCLBASE}**/ya.make ${EXCLBASE}**/a.yaml ${pre=${EXCLBASE}:EXCLUDES}
  3897. _LATE_GLOB(_${var_prefix}_FILES ${_PATTERN} EXCLUDE ${_EXCLUDES})
  3898. SET(${var_prefix}_PATTERN ${_PATTERN})
  3899. SET(${var_prefix}_EXCLUDES ${_EXCLUDES})
  3900. }
  3901. ### @usage: DECLARE_IN_DIRS(var_prefix files_mask DIRS dirs [RECURSIVE] [EXCLUDES excludes] [SRCDIR srcdir])
  3902. ###
  3903. ### This macro allow passing content of directories to macros like `RUN_PROGRAM` and `RUN_PYTHON3` as IN parameter.
  3904. ###
  3905. ### The content is matched by following rules:
  3906. ### - The files are looked in <srcdir>. The srcdir is relative to module directory and defaulted to module directory.
  3907. ### - Inside <srcdir> files are looked in all <dirs>, recursively or not depending on RECURSIVE parameter.
  3908. ### - Files are matched by file_mask which may contain * or ?.
  3909. ### - <excludes> are then applied over matched files. Excludes are regular globs including recursive parts support.
  3910. ###
  3911. ### Taking `var_prefix` macro declared 4 variables:
  3912. ### - <var_prefix>_FILES - the file list matched by the macro using rules above. This variable can be passed to `IN` parameter of `RUN_PROGRAM` and alikes.
  3913. ### Also it may be passed escaped as argument to tool/script. See example below.
  3914. ### - <var_prefix>_PATTERNS - the glob patterns used for match.
  3915. ### - <var_prefix>_EXCLUDES - exclude patterns from EXCLUDES argument and ones to exclude ya.make and a.yaml
  3916. ### - <var_prefix>_SRCDIR - value of SRCDIR argument
  3917. ###
  3918. ### Parameters:
  3919. ### - var_prefix - Mandatory prefix of variables the macro declares
  3920. ### - file_mask - Mandatory glob-like mask for files
  3921. ### file_mask should not conatain '**'
  3922. ### - DIRS dirs - Mandatory list of dirs relative to srcdir or current one in which files should be looked
  3923. ### Dirs cannot contain ${ARCADIA_ROOT} (and other similar vars), '..', '*' or '?'.
  3924. ### - RECURSIVE - Optional request to lookup dirs recursively. Default is non-recursive lookup
  3925. ### - EXCLUDES excludes - Optional list of globs to exclude from match.
  3926. ### - SRCDIR srcdir - Optional directory (relative to current one) to apply globs. Default is the current dir.
  3927. ### We strongly discourage this, but srcdir may contain '..' or start from ${ARCADIA_ROOT} for root-relative addressing.
  3928. ### scrdir cannot contain any of '*' or '?'
  3929. ###
  3930. ### Examples:
  3931. ### ```
  3932. ### DECLARE_IN_DIRS(TXT *.txt DIRS . EXCLUDE .*.txt **/.*.txt)
  3933. ### # file list requires escaping as argument
  3934. ### RUN_PYTHON3(concat.py \${TXT_FILES} IN ${TXT_FILES} STDOUT concatenated.txt)
  3935. ### ```
  3936. ###
  3937. ### ```
  3938. ### DECLARE_IN_DIRS(ALL_TXT *.txt SRCDIR txt RECURSIVE DIRS design rules EXCLUDE all.txt)
  3939. ### RUN_PYTHON3(concat_all.py --dirs ${MODDIR}/${ALL_TXT_SRCDIR} --pattern ${ALL_TXT_PATTERNS} --exclude ${ALL_TXT_EXCLUDES} IN ${ALL_TXT_FILES} STDOUT concatenated.txt)
  3940. ### ```
  3941. ###
  3942. ### ```
  3943. ### DECLARE_IN_DIRS(D_TXT *.txt SRCDIR txt/design EXCLUDE all.txt DIRS .)
  3944. ### DECLARE_IN_DIRS(R_TXT *.txt SRCDIR txt/rules DIRS .)
  3945. ### RUN_PYTHON3(concat_all.py --dirs ${MODDIR}/${D_TXT_SRCDIR} ${MODDIR}/${R_TXT_SRCDIR} --patterns ${D_TXT_PATTERNS} ${R_TXT_PATTERNS} --exclude ${D_TXT_EXCLUDES} IN ${D_TXT_FILES} ${R_TXT_FILES} STDOUT concatenated.txt)
  3946. ### ```
  3947. ###
  3948. ### Notes:
  3949. ### 1. All 'ya.make' and 'a.yaml' files are excluded from match.
  3950. ### 2. Matched files are never parsed for dependencies even though they shall be passed to IN, not to IN_NOPARSE.
  3951. ### 3. The list of files expanded late and will not work in macros like SRCS. This macro only meant for use with generating macros like RUN_PROGRAM processing entire matching list with one command.
  3952. ### 4. We support extended file mask syntax for multiple masks like "(*.cpp|*.h)". However, this will be preserved in <var_prefix>_PATTERNS variable and so tool/script either should support such syntax or
  3953. ### or should not rely on value of the variable for actual matching.
  3954. ### 5. There is known issue with empty match and escaped substitution like `concat.py \${TXT_FILES}`. It may result in weird errors and can be workarounded by extra argument like `concat.py - \${TXT_FILES}`
  3955. ### 6. EXCLUDES work differently with SRCDIR is specified. Use discriminating tail of SRCDIR in order to match exact files non-recursively.
  3956. ### E.g. if SRCDIR is a/b/zz and EXCLUDE is *.x the exclude will work recursively on all matches including zz's child dierctories. To limit match to zz's level use EXCLUDE zz/*.x instead.
  3957. ### 6. Parameters of macro are somewhat validated and we may add extra checks in the fulture including protection over too broad match.
  3958. ###
  3959. macro DECLARE_IN_DIRS(var_prefix, PATTERN, SRCDIR="", RECURSIVE?"**/":"", EXCLUDES[], DIRS[]) {
  3960. _DECL_IN_DIR_GLOB($var_prefix $PATTERN $RECURSIVE ${pre=SRCDIR ;suf=/:SRCDIR} ${pre=EXCLBASE ${ARCADIA_ROOT}/**/ DUMMY :SRCDIR} EXCLUDES ${EXCLUDES} DIRS ${DIRS})
  3961. SET(${var_prefix}_FILES \$_${var_prefix}_FILES)
  3962. SET(${var_prefix}_SRCDIR $SRCDIR)
  3963. VALIDATE_IN_DIRS(${var_prefix}_FILES $PATTERN $SRCDIR -- $DIRS)
  3964. }
  3965. ### @usage: RUN_PROGRAM(tool_path args... [CWD dir] [ENV key=value...] [TOOL tools...] [IN[_NOPARSE] inputs...] [OUT[_NOAUTO] outputs...] [STDOUT[_NOAUTO] output] [OUTPUT_INCLUDES output_includes...] [INDUCED_DEPS $VARs...])
  3966. ###
  3967. ### Run a program from arcadia.
  3968. ### These macros are similar: RUN_PROGRAM, RUN_LUA, PYTHON.
  3969. ###
  3970. ### Parameters:
  3971. ### - tool_path - Path to the directory of the tool.
  3972. ### - args... - Program arguments. Relative paths listed in TOOL, IN, OUT, STDOUT become absolute.
  3973. ### - CWD dir - Absolute path of the working directory.
  3974. ### - ENV key=value... - Environment variables.
  3975. ### - TOOL tools... - Auxiliary tool directories.
  3976. ### - IN[_NOPARSE] inputs... - Input files. NOPARSE inputs are treated as textual and not parsed for dependencies regardless of file extensions.
  3977. ### - OUT[_NOAUTO] outputs... - Output files. NOAUTO outputs are not automatically added to the build process.
  3978. ### - STDOUT[_NOAUTO] output - Redirect the standard output to the output file.
  3979. ### - OUTPUT_INCLUDES output_includes... - Includes of the output files that are needed to build them.
  3980. ### - INDUCED_DEPS $VARs... - Dependencies for generated files. Unlike `OUTPUT_INCLUDES` these may target files further in processing chain.
  3981. ### In order to do so VAR should be filled by PREPARE_INDUCED_DEPS macro, stating target files (by type) and set of dependencies
  3982. ###
  3983. ### For absolute paths use ${ARCADIA_ROOT} and ${ARCADIA_BUILD_ROOT}, or
  3984. ### ${CURDIR} and ${BINDIR} which are expanded where the outputs are used.
  3985. ### Note that Tool is always built for the host platform, so be careful to provide that tool can be built for all Arcadia major host platforms (Linux, MacOS and Windows).
  3986. macro RUN_PROGRAM(Tool, IN{input}[], IN_NOPARSE{input}[], OUT{output}[], OUT_NOAUTO{output}[], TOOL{tool}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], IN_DEPS[], STDOUT="", STDOUT_NOAUTO="", CWD="", ENV[], Args...) {
  3987. .CMD=${cwd:CWD} ${env:ENV} ${tool:Tool} $Args ${hide;input:IN} ${hide;context=TEXT;input:IN_NOPARSE} ${hide;input:IN_DEPS} ${hide;output_include:OUTPUT_INCLUDES} $INDUCED_DEPS ${hide;tool:TOOL} ${hide;output:OUT} ${hide;noauto;output:OUT_NOAUTO} ${stdout;output:STDOUT} ${stdout;noauto;output:STDOUT_NOAUTO} ${hide;kv:"p PR"} ${hide;kv:"pc yellow"} ${hide;kv:"show_out"}
  3988. .SEM=custom_runs-ITEM && custom_runs-depends ${input:IN} ${context=TEXT;input:IN_NOPARSE} ${tool:Tool} ${tool:TOOL} ${pre=&& custom_runs-env :ENV} && custom_runs-command ${tool:Tool} $Args ${pre=> :STDOUT} ${pre=> :STDOUT_NOAUTO} && custom_runs-outputs ${output:OUT} ${noauto;output:OUT_NOAUTO} ${output:STDOUT} ${noauto;output:STDOUT_NOAUTO} ${pre=&& custom_runs-cwd :CWD}
  3989. }
  3990. # tag:lua-specific
  3991. ### @usage: RUN_LUA(script_path args... [CWD dir] [ENV key=value...] [TOOL tools...] [IN[_NOPARSE] inputs...] [OUT[_NOAUTO] outputs...] [STDOUT[_NOAUTO] output] [OUTPUT_INCLUDES output_includes...] [INDUCED_DEPS $VARs...])
  3992. ###
  3993. ### Run a lua script.
  3994. ### These macros are similar: RUN_PROGRAM, RUN_LUA, PYTHON.
  3995. ###
  3996. ### Parameters:
  3997. ### - script_path - Path to the script.3
  3998. ### - args... - Program arguments. Relative paths listed in TOOL, IN, OUT, STDOUT become absolute.
  3999. ### - CWD dir - Absolute path of the working directory.
  4000. ### - ENV key=value... - Environment variables.
  4001. ### - TOOL tools... - Auxiliary tool directories.
  4002. ### - IN[_NOPARSE] inputs... - Input files. NOPARSE inputs are treated as textual and not parsed for dependencies regardless of file extensions.
  4003. ### - OUT[_NOAUTO] outputs... - Output files. NOAUTO outputs are not automatically added to the build process.
  4004. ### - STDOUT[_NOAUTO] output - Redirect the standard output to the output file.
  4005. ### - OUTPUT_INCLUDES output_includes... - Includes of the output files that are needed to build them.
  4006. ### - INDUCED_DEPS $VARs... - Dependencies for generated files. Unlike `OUTPUT_INCLUDES` these may target files further in processing chain.
  4007. ### In order to do so VAR should be filled by PREPARE_INDUCED_DEPS macro, stating target files (by type) and set of dependencies
  4008. ###
  4009. ### For absolute paths use ${ARCADIA_ROOT} and ${ARCADIA_BUILD_ROOT}, or
  4010. ### ${CURDIR} and ${BINDIR} which are expanded where the outputs are used.
  4011. macro RUN_LUA(ScriptPath, IN{input}[], IN_NOPARSE{input}[], OUT{output}[], OUT_NOAUTO{output}[], TOOL{tool}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], STDOUT="", STDOUT_NOAUTO="", CWD="", ENV[], Args...) {
  4012. .CMD=${cwd:CWD} ${env:ENV} $LUA_TOOL ${input:ScriptPath} $Args ${hide;input:IN} ${hide;context=TEXT;input:IN_NOPARSE} ${hide;output_include:OUTPUT_INCLUDES} $INDUCED_DEPS ${hide;tool:TOOL} ${hide;output:OUT} ${hide;noauto;output:OUT_NOAUTO} ${stdout;output:STDOUT} ${stdout;noauto;output:STDOUT_NOAUTO} ${hide;kv:"p LU"} ${hide;kv:"pc yellow"} ${hide;kv:"show_out"}
  4013. }
  4014. # tag:python-specific
  4015. ### @usage: RUN_PYTHON3(script_path args... [CWD dir] [ENV key=value...] [TOOL tools...] [IN[_NOPARSE] inputs...] [OUT[_NOAUTO] outputs...] [STDOUT[_NOAUTO] output] [OUTPUT_INCLUDES output_includes...] [INDUCED_DEPS $VARs...])
  4016. ###
  4017. ### Run a python script with prebuilt python3 interpretor built from devtools/huge_python3.
  4018. ### These macros are similar: RUN_PROGRAM, RUN_LUA, PYTHON.
  4019. ###
  4020. ### Parameters:
  4021. ### - script_path - Path to the script.
  4022. ### - args... - Program arguments. Relative paths listed in TOOL, IN, OUT, STDOUT become absolute.
  4023. ### - CWD dir - Absolute path of the working directory.
  4024. ### - ENV key=value... - Environment variables.
  4025. ### - TOOL tools... - Auxiliary tool directories.
  4026. ### - IN[_NOPARSE] inputs... - Input files. NOPARSE inputs are treated as textual and not parsed for dependencies regardless of file extensions.
  4027. ### - OUT[_NOAUTO] outputs... - Output files. NOAUTO outputs are not automatically added to the build process.
  4028. ### - STDOUT[_NOAUTO] output - Redirect the standard output to the output file.
  4029. ### - OUTPUT_INCLUDES output_includes... - Includes of the output files that are needed to build them.
  4030. ### - INDUCED_DEPS $VARs... - Dependencies for generated files. Unlike `OUTPUT_INCLUDES` these may target files further in processing chain.
  4031. ### In order to do so VAR should be filled by PREPARE_INDUCED_DEPS macro, stating target files (by type) and set of dependencies
  4032. ###
  4033. ### For absolute paths use ${ARCADIA_ROOT} and ${ARCADIA_BUILD_ROOT}, or
  4034. ### ${CURDIR} and ${BINDIR} which are expanded where the outputs are used.
  4035. macro RUN_PYTHON3(ScriptPath, IN{input}[], IN_NOPARSE{input}[], OUT{output}[], OUT_NOAUTO{output}[], TOOL{tool}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], STDOUT="", STDOUT_NOAUTO="", CWD="", ENV[], Args...) {
  4036. .CMD=${cwd:CWD} ${env:ENV} $YMAKE_PYTHON3 ${input:ScriptPath} $Args ${hide;input:IN} ${hide;context=TEXT;input:IN_NOPARSE} ${hide;output_include:OUTPUT_INCLUDES} $INDUCED_DEPS ${hide;tool:TOOL} ${hide;output:OUT} ${hide;noauto;output:OUT_NOAUTO} ${stdout;output:STDOUT} ${stdout;noauto;output:STDOUT_NOAUTO} ${hide;kv:"p PY"} ${hide;kv:"pc yellow"} ${hide;kv:"show_out"}
  4037. .SEM=custom_runs-ITEM && custom_runs-depends ${input:IN} ${context=TEXT;input:IN_NOPARSE} ${input:ScriptPath} ${tool:TOOL} ${pre=&& custom_runs-env :ENV} && custom_runs-command python3 ${input:ScriptPath} $Args ${pre=> :STDOUT} ${pre=> :STDOUT_NOAUTO} && custom_runs-outputs ${output:OUT} ${noauto;output:OUT_NOAUTO} ${output:STDOUT} ${noauto;output:STDOUT_NOAUTO} ${pre=&& custom_runs-cwd :CWD} && custom_runs-cmake_packages-ITEM && custom_runs-cmake_packages-name Python3
  4038. }
  4039. # tag:java-specific
  4040. macro _RUN_ANTLR_BASE(IN{input}[], IN_NOPARSE{input}[], OUT{output}[], OUT_NOAUTO{output}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], TOOL[], STDOUT="", STDOUT_NOAUTO="", CWD="", JAR[], SEM="run_java", ENV[], HIDE_OUTPUT?"stderr2stdout":"stdout2stderr", Args...) {
  4041. PEERDIR(build/platform/java/jdk $JDK_RESOURCE_PEERDIR)
  4042. .CMD=${cwd:CWD} ${env:ENV} $YMAKE_PYTHON ${input;pre=build/scripts/:HIDE_OUTPUT.py} $JDK_RESOURCE/bin/java $JAR $Args ${hide;tool:TOOL} ${hide;input:IN} ${hide;context=TEXT;input:IN_NOPARSE} ${hide;output_include:OUTPUT_INCLUDES} $INDUCED_DEPS ${hide;output:OUT} ${hide;noauto;output:OUT_NOAUTO} ${stdout;output:STDOUT} ${stdout;noauto;output:STDOUT_NOAUTO} ${hide;kv:"p JV"} ${hide;kv:"pc light-blue"} ${hide;kv:"show_out"}
  4043. .SEM=custom_runs-ITEM && custom_runs-depends ${input:IN} && custom_runs-command $SEM && custom_runs-command $Args && custom_runs-outputs ${output:OUT} ${noauto;output:OUT_NOAUTO} ${pre=&& custom_runs-cwd :CWD}
  4044. }
  4045. ### @usage: FROM_SANDBOX([FILE] resource_id [AUTOUPDATED script] [RENAME <resource files>] OUT_[NOAUTO] <output files> [EXECUTABLE] [OUTPUT_INCLUDES <include files>] [INDUCED_DEPS $VARs...])
  4046. ###
  4047. ### Download the resource from the Sandbox, unpack (if not explicitly specified word FILE) and add OUT files to the build. EXECUTABLE makes them executable.
  4048. ### You may specify extra dependencies that output files bring using OUTPUT_INCLUDES or INDUCED_DEPS. The change of these may e.g. lead to recompilation of .cpp files extracted from resource.
  4049. ### If there is no default processing for OUT files or you need process them specially use OUT_NOAUTO instead of OUT.
  4050. ###
  4051. ### It is disallowed to specify directory as OUT/OUT_NOAUTO since all outputs of commands shall be known to build system.
  4052. ###
  4053. ### RENAME renames files to the corresponding OUT and OUT_NOAUTO outputs:
  4054. ### FROM_SANDBOX(resource_id RENAME in_file1 in_file2 OUT out_file1 out_file2 out_file3)
  4055. ### FROM_SANDBOX(resource_id RENAME in_file1 OUT out_file1 RENAME in_file2 OUT out_file2)
  4056. ### FROM_SANDBOX(FILE resource_id RENAME resource_file OUT out_name)
  4057. ###
  4058. ### RENAME RESOURCE allows to rename the resource without specifying its file name.
  4059. ###
  4060. ### OUTPUT_INCLUDES output_includes... - Includes of the output files that are needed to build them.
  4061. ### INDUCED_DEPS $VARs... - Dependencies for generated files. Unlike `OUTPUT_INCLUDES` these may target files further in processing chain.
  4062. ### In order to do so VAR should be filled by PREPARE_INDUCED_DEPS macro, stating target files (by type) and set of dependencies
  4063. ###
  4064. ### If AUTOUPDATED is specified than macro will be regularly updated according to autoupdate script. The dedicated Sandbox task scans the arcadia and
  4065. ### changes resource_ids in such macros if newer resource of specified type is available. Note that the task seeks AUTOUPDATED in specific position,
  4066. ### so you shall place it immediately after resource_id.
  4067. macro FROM_SANDBOX(Id, OUT{output}[], OUT_NOAUTO{output}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], FILE?"--copy-to-dir":"--untar-to", AUTOUPDATED="", PREFIX=".", RENAME[], EXECUTABLE?"--executable":"", SBR="sbr:") {
  4068. .CMD=${hide:SANDBOX_FAKEID} ${cwd:BINDIR} ${resource;pre=$SBR:Id} $YMAKE_PYTHON ${input:"build/scripts/fetch_from_sandbox.py"} --resource-file $(RESOURCE_ROOT)/sbr/$Id/resource --resource-id $Id $FILE $PREFIX ${pre=--rename :RENAME} $EXECUTABLE -- $OUT $OUT_NOAUTO ${hide;input:"build/scripts/fetch_from.py"} ${hide;output_include:OUTPUT_INCLUDES} $INDUCED_DEPS ${hide;output:OUT} ${hide;noauto;output:OUT_NOAUTO} ${requirements;hide:"network:full"} ${hide;kv:"p SB"} ${hide;kv:"pc yellow"} ${hide;kv:"show_out"}
  4069. ADD_CHECK(check.resource $Id)
  4070. }
  4071. ### @usage: LARGE_FILES([AUTOUPDATED] Files...)
  4072. ###
  4073. ### Use large file ether from working copy or from remote storage via placeholder <File>.external
  4074. ### If <File> is present locally (and not a symlink!) it will be copied to build directory.
  4075. ### Otherwise macro will try to locate <File>.external, parse it retrieve ot during build phase.
  4076. macro LARGE_FILES(AUTOUPDATED?, Files...) {
  4077. # This is needed to correctly switch between remote and local modes
  4078. _GLOB($LF $Files)
  4079. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS ${suf=.external:Files})
  4080. }
  4081. ### @usage: FROM_ARCHIVE(Src [RENAME <resource files>] OUT_[NOAUTO] <output files> [EXECUTABLE] [OUTPUT_INCLUDES <include files>] [INDUCED_DEPS $VARs...])
  4082. ###
  4083. ### Process file archive as [FROM_SANDBOX()](#macro_FROM_SANDBOX).
  4084. macro FROM_ARCHIVE(Src, OUT{output}[], OUT_NOAUTO{output}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], PREFIX=".", RENAME[], EXECUTABLE?"--executable":"") {
  4085. .CMD=${cwd:BINDIR} $YMAKE_PYTHON ${input:"build/scripts/fetch_from_archive.py"} "--archive" ${input:Src} "--file-name" ${suf=-:Src} "--untar-to" $PREFIX ${pre=--rename :RENAME} $EXECUTABLE -- $OUT $OUT_NOAUTO ${hide;input:"build/scripts/fetch_from.py"} ${hide;output_include:OUTPUT_INCLUDES} $INDUCED_DEPS ${hide;output:OUT} ${hide;noauto;output:OUT_NOAUTO} ${hide;kv:"p FA"} ${hide;kv:"pc yellow"} ${hide;kv:"show_out"}
  4086. }
  4087. when ($MSVC == "yes") {
  4088. C_AS_CXX_FLAGS=/TP /std:c++17
  4089. }
  4090. otherwise {
  4091. C_AS_CXX_FLAGS=-x c++ -std=c++17
  4092. }
  4093. # tag:cpp-specific
  4094. ### @usage: COMPILE_C_AS_CXX()
  4095. ###
  4096. ### Compile .c files as .cpp ones within a module.
  4097. macro COMPILE_C_AS_CXX() {
  4098. SET(EXTRA_C_FLAGS $C_AS_CXX_FLAGS)
  4099. }
  4100. ### @usage: NO_DEBUG_INFO()
  4101. ###
  4102. ### Compile files without debug info collection.
  4103. macro NO_DEBUG_INFO() {
  4104. SET(NO_DEBUGINFO yes)
  4105. }
  4106. ### @usage: CTEMPLATE_VARNAMES(File)
  4107. ###
  4108. ### Generate File.varnames.h using contrib/libs/ctemplate/make_tpl_varnames_h
  4109. ###
  4110. ### Documentation: https://a.yandex-team.ru/arc/trunk/arcadia/contrib/libs/ctemplate/README.md
  4111. macro CTEMPLATE_VARNAMES(File) {
  4112. .CMD=${tool:"contrib/libs/ctemplate/make_tpl_varnames_h"} -f ${output;addincl;nopath;noallext:File.varnames.h} ${input:File}
  4113. }
  4114. LLVM_OPTS=
  4115. CLANG_BC_ROOT=
  4116. macro USE_LLVM_BC14() {
  4117. SET(CLANG_BC_ROOT ${CLANG14_RESOURCE_GLOBAL})
  4118. SET(LLVM_LLC_TOOL contrib/libs/llvm14/tools/llc)
  4119. }
  4120. macro USE_LLVM_BC16() {
  4121. SET(CLANG_BC_ROOT ${CLANG16_RESOURCE_GLOBAL})
  4122. SET(LLVM_LLC_TOOL contrib/libs/llvm16/tools/llc)
  4123. }
  4124. macro USE_LLVM_BC18() {
  4125. SET(CLANG_BC_ROOT ${CLANG18_RESOURCE_GLOBAL})
  4126. SET(LLVM_LLC_TOOL contrib/libs/llvm18/tools/llc)
  4127. }
  4128. ### @usage: CLANG_EMIT_AST_CXX(Input Output Opts...)
  4129. ###
  4130. ### Emit Clang AST from .cpp file. CXXFLAGS and LLVM_OPTS are passed in, while CFLAGS and C_FLAGS_PLATFORM are not.
  4131. ### Note: Output name is used as is, no extension added.
  4132. macro CLANG_EMIT_AST_CXX(Input, Output, Opts...) {
  4133. .CMD=$YMAKE_PYTHON ${input:"build/scripts/clang_wrapper.py"} $WINDOWS ${CLANG_RESOURCE_GLOBAL}/bin/clang++ ${pre=-I:_C__INCLUDE} $CXXFLAGS $C_FLAGS_PLATFORM $LLVM_OPTS -emit-ast -c ${input:Input} -o ${noauto;output:Output} $Opts ${hide;kv:"p ST"} ${hide;kv:"pc light-green"}
  4134. PEERDIR(build/platform/clang)
  4135. }
  4136. ### @usage: LLVM_COMPILE_CXX(Input Output Opts...)
  4137. ###
  4138. ### Emit LLVM bytecode from .cpp file. BC_CXXFLAGS, LLVM_OPTS and C_FLAGS_PLATFORM are passed in, while CFLAGS are not.
  4139. ### Note: Output name is used as is, no extension added.
  4140. macro LLVM_COMPILE_CXX(Input, Output, Opts...) {
  4141. .CMD=$YMAKE_PYTHON ${input:"build/scripts/clang_wrapper.py"} $WINDOWS ${CLANG_BC_ROOT}/bin/clang++ ${pre=-I:_C__INCLUDE} $BC_CXXFLAGS $C_FLAGS_PLATFORM -Wno-unknown-warning-option $LLVM_OPTS ${NO_LTO_CFLAGS} -emit-llvm -c ${input:Input} -o ${noauto;output:Output} $Opts ${hide;kv:"p BC"} ${hide;kv:"pc light-green"}
  4142. .SEM=target_macroses-ITEM && target_macroses-macro llvm_compile_cxx && target_macroses-args ${input:Input} ${noauto;output:Output} ${"${CLANGPLUSPLUS}"} -Wno-unknown-warning-option $LLVM_OPTS ${NO_LTO_CFLAGS} -emit-llvm ${Opts}
  4143. .STRUCT_CMD=yes
  4144. when ($CLANG_BC_ROOT == "") {
  4145. _OK = no
  4146. }
  4147. ASSERT(_OK "Invoke USE_LLVM_BC() with specific version first")
  4148. PEERDIR(build/platform/clang)
  4149. }
  4150. ### @usage: LLVM_COMPILE_C(Input Output Opts...)
  4151. ###
  4152. ### Emit LLVM bytecode from .c file. BC_CFLAGS, LLVM_OPTS and C_FLAGS_PLATFORM are passed in, while CFLAGS are not.
  4153. ### Note: Output name is used as is, no extension added.
  4154. macro LLVM_COMPILE_C(Input, Output, Opts...) {
  4155. .CMD=$YMAKE_PYTHON ${input:"build/scripts/clang_wrapper.py"} $WINDOWS ${CLANG_BC_ROOT}/bin/clang ${pre=-I:_C__INCLUDE} $BC_CFLAGS $C_FLAGS_PLATFORM $LLVM_OPTS ${NO_LTO_CFLAGS} -emit-llvm -c ${input:Input} -o ${noauto;output:Output} $Opts ${hide;kv:"p BC"} ${hide;kv:"pc light-green"}
  4156. .SEM=target_macroses-ITEM && target_macroses-macro llvm_compile_c && target_macroses-args ${input:Input} ${noauto;output:Output} ${"${CLANGC}"} -Wno-unknown-warning-option $LLVM_OPTS ${NO_LTO_CFLAGS} -emit-llvm ${Opts}
  4157. .STRUCT_CMD=yes
  4158. when ($CLANG_BC_ROOT == "") {
  4159. _OK = no
  4160. }
  4161. ASSERT(CLANG_BC_ROOT "Invoke USE_LLVM_BC() with specific version first")
  4162. PEERDIR(build/platform/clang)
  4163. }
  4164. ### @usage: BPF(Input Output Opts...)
  4165. ###
  4166. ### Emit eBPF bytecode from .c file.
  4167. ### Note: Output name is used as is, no extension added.
  4168. macro BPF(Input, Output, Opts...) {
  4169. .CMD=$YMAKE_PYTHON ${input:"build/scripts/clang_wrapper.py"} $WINDOWS ${CLANG_RESOURCE_GLOBAL}/bin/clang ${pre=-I:_C__INCLUDE} $C_FLAGS_PLATFORM -target bpf -c ${input:Input} -o ${noauto;output:Output} $Opts ${hide;kv:"p BP"} ${hide;kv:"pc light-green"}
  4170. PEERDIR(build/platform/clang)
  4171. }
  4172. LD_BINARY_NAME=ld
  4173. when($OS_LINUX) {
  4174. LD_BINARY_NAME=ld.lld
  4175. }
  4176. ### @usage: BPF_STATIC(Input Output Opts...)
  4177. ###
  4178. ### Emit eBPF bytecode from .c file.
  4179. ### Note: Output name is used as is, no extension added.
  4180. macro BPF_STATIC(Input, Output, Opts...) {
  4181. .CMD=$YMAKE_PYTHON ${input:"build/scripts/clang_wrapper.py"} $WINDOWS ${CLANG_RESOURCE_GLOBAL}/bin/clang ${pre=-I:_C__INCLUDE} $C_FLAGS_PLATFORM -target bpf -c ${input:Input} -o ${noauto;output:Output} $Opts ${hide;kv:"p BP"} ${hide;kv:"pc light-green"} && ${cwd:BINDIR} $LLD_ROOT_RESOURCE_GLOBAL/bin/$LD_BINARY_NAME -r -b binary -m elf_x86_64 -o ${noauto;output;suf=.bpf.o:Input} ${noauto;nopath:Output}
  4182. PEERDIR(build/platform/clang build/platform/lld)
  4183. }
  4184. ### @usage: LLVM_COMPILE_LL(Input Output Opts...)
  4185. ###
  4186. ### Compile LLVM bytecode to object representation.
  4187. ### Note: Output name is used as is, no extension added.
  4188. macro LLVM_COMPILE_LL(Input, Output, Opts...) {
  4189. .CMD=${CLANG_BC_ROOT}/bin/llvm-as ${input:Input} -o ${noauto;output:Output} ${hide;kv:"p BC"} ${hide;kv:"pc light-green"}
  4190. .SEM=custom_runs-ITEM && custom_runs-depends ${input:Input} && custom_runs-command ${LLVMAS} ${input:Input} -o ${noauto;output:Output} && custom_runs-outputs ${noauto;output:Output}
  4191. PEERDIR(build/platform/clang)
  4192. }
  4193. ### @usage: LLVM_LINK(Output Inputs...)
  4194. ###
  4195. ### Call llvm-link on set of Inputs to produce Output.
  4196. ### Note: Unlike many other macros output argument goes first. Output name is used as is, no extension added.
  4197. macro LLVM_LINK(Output, Inputs...) {
  4198. .CMD=${CLANG_BC_ROOT}/bin/llvm-link ${input:Inputs} -o ${noauto;output:Output} ${hide;kv:"p LD"} ${hide;kv:"pc light-red"}
  4199. .SEM=custom_runs-ITEM && custom_runs-depends ${input:Inputs} && custom_runs-command ${LLVMLINK} ${input:Inputs} -o ${noauto;output:Output} && custom_runs-outputs ${noauto;output:Output}
  4200. PEERDIR(build/platform/clang)
  4201. }
  4202. ### @usage: LLVM_OPT(Input Output Opts...)
  4203. ###
  4204. ### Call llvm-opt with set of Opts on Input to produce Output.
  4205. ### Note: Output name is used as is, no extension added.
  4206. macro LLVM_OPT(Input, Output, Opts...) {
  4207. .CMD=$YMAKE_PYTHON ${input:"build/scripts/llvm_opt_wrapper.py"} ${CLANG_BC_ROOT}/bin/opt ${input:Input} -o ${noauto;output:Output} $Opts ${hide;kv:"p OP"} ${hide;kv:"pc yellow"}
  4208. .SEM=custom_runs-ITEM && custom_runs-depends ${input:Input} && custom_runs-command ${LLVMOPT} ${input:Input} -o ${noauto;output:Output} $Opts && custom_runs-outputs ${noauto;output:Output}
  4209. PEERDIR(build/platform/clang)
  4210. }
  4211. ### @usage: LLVM_LLC(Src Opts...)
  4212. ###
  4213. ### Call llvm-llc with set of Opts on Src to produce object file.
  4214. ###
  4215. ### Note: Output name is calculated as concatenation of Src name and platform specific object file extension.
  4216. macro LLVM_LLC(Src, Opts...) {
  4217. .CMD=${tool:LLVM_LLC_TOOL} ${input:Src} --filetype obj -o ${output;suf=$OBJECT_SUF;noauto:Src} $Opts ${hide;kv:"p LC"} ${hide;kv:"pc yellow"}
  4218. .SEM=custom_runs-ITEM && custom_runs-depends ${input:Src} && custom_runs-command ${LLVMLLC} --filetype obj ${input:Src} -o ${output;suf=$OBJECT_SUF;noauto:Src} $Opts && custom_runs-outputs ${output;suf=$OBJECT_SUF;noauto:Src}
  4219. PEERDIR(build/platform/clang)
  4220. }
  4221. when ($NO_DEBUGINFO == "yes") {
  4222. DEBUG_INFO_FLAGS=
  4223. }
  4224. when ($CLANG && $DEBUGINFO_LINES_ONLY == "yes" && $NO_DEBUGINFO != "yes") {
  4225. DEBUG_INFO_FLAGS=-gline-tables-only
  4226. }
  4227. # NB: Assertions under sanitizers are disabled as they cause
  4228. # a couple _relocation out of range_ problems plus an
  4229. # ICE when building contrib/libs/hyperscan/runtime_avx512.
  4230. when ($BUILD_TYPE == "RELEASE" || $BUILD_TYPE == "MINSIZEREL" || $BUILD_TYPE == "VALGRIND-RELEASE" || $BUILD_TYPE == "PROFILE" || $BUILD_TYPE == "GPROF" || $BUILD_TYPE == "DEBUGNOASSERTS") {
  4231. CFLAGS += -DNDEBUG
  4232. when ($OS_WINDOWS) {
  4233. # FIXME: defining _DEBUG on Linux gives more relation problems and breaks certain tests
  4234. CFLAGS += -U_DEBUG
  4235. # For the flags regarding runtime library selection, see
  4236. # https://msdn.microsoft.com/en-us/library/abx4dbyh.aspx
  4237. CFLAGS += /MT
  4238. }
  4239. }
  4240. otherwise {
  4241. CFLAGS += -UNDEBUG
  4242. when ($OS_WINDOWS) {
  4243. CFLAGS += -D_DEBUG
  4244. CFLAGS += /MTd
  4245. }
  4246. }
  4247. # TODO: configurable tar and touch
  4248. PACK_TGZ=${cwd:ARCADIA_BUILD_ROOT} tar -czf ${rootrel:OUTPUT} ${rootrel:INPUT} ${hide;kv:"p AR"} ${hide;kv:"pc light-red"}
  4249. # tag:internal
  4250. ### @usage: TOUCH(Outputs...) # internal
  4251. ### Just introduce outputs
  4252. macro TOUCH(Outputs...) {
  4253. .CMD=$YMAKE_PYTHON ${input:"build/scripts/touch.py"} ${output:Outputs}
  4254. }
  4255. TOUCH_UNIT=$YMAKE_PYTHON3 ${input:"build/scripts/touch.py"} ${hide;kv:"p UN"} ${hide;kv:"pc light-cyan"} $TARGET
  4256. FAKE_PACKAGE_CMD=$YMAKE_PYTHON3 ${input:"build/scripts/touch.py"} ${hide;kv:"pc light-red"} $TARGET
  4257. COPY_PACKAGE_CMD=$YMAKE_PYTHON3 ${input:"build/scripts/copy_to_dir.py"} --dest-dir $BINDIR --build-root $ARCADIA_BUILD_ROOT $PACKED_PACKAGE_ARGS $SRCS_GLOBAL $PEERS_LATE_OUTS ${skip_by_ext=.pkg.fake:PEERS} ${hide;late_out:AUTO_INPUT} ${hide;late_out;to_namespace=$BINDIR/:SRCS_GLOBAL} ${hide;late_out;to_namespace=$BINDIR/:PEERS_LATE_OUTS} ${hide;late_out;skip_by_ext=.pkg.fake;to_namespace=$BINDIR/:PEERS} ${hide;kv:"package PACKAGE"}
  4258. TOUCH_PACKAGE=$FAKE_PACKAGE_CMD $VCS_INFO_DISABLE_CACHE__NO_UID__ && $COPY_PACKAGE_CMD
  4259. _P_PK=${hide;kv:"p PK"}
  4260. TOUCH_PACKAGE_MF=$GENERATE_MF && $TOUCH_PACKAGE $_P_PK && $ADD_VCS_INFO_FILE_CMD
  4261. # Note: we don't use touch.py in the command below to avoid introduction of undesired input
  4262. UNION_CMD=$YMAKE_PYTHON -c open(\'$TARGET\',\'w\').close() ${hide;kv:"p UN"} ${hide;kv:"package UNION"} ${hide;kv:"pc light-cyan"} $UNION_OUTS $VCS_INFO_DISABLE_CACHE__NO_UID__
  4263. UNION_CMD_MF=$UNION_CMD && $GENERATE_MF
  4264. macro _EXPAND_INS_OUTS(FILES{input}[]) {
  4265. .CMD=${hide;input:FILES} ${late_out;hide:INPUT}
  4266. }
  4267. _UNION_EXPLICIT_OUTPUTS=
  4268. ### @usage: EXPLICIT_OUTPUTS(Files...)
  4269. ###
  4270. ### Let UNION has only explicitly specified outputs listed in this macro
  4271. ### The list of files shall contain results of commands in this UNION.
  4272. ### Only these files will be outputs of the UNION. This allows to eliminate
  4273. ### intermediate files being result of the UNION
  4274. macro EXPLICIT_OUTPUTS(Files...) {
  4275. SET_APPEND(_UNION_EXPLICIT_OUTPUTS ${Files})
  4276. }
  4277. NO_CHECK_IMPORTS_FOR_VALUE=None
  4278. ### @usage: NO_CHECK_IMPORTS([patterns])
  4279. ###
  4280. ### Do not run checks on imports of Python modules.
  4281. ### Optional parameter mask patterns describes the names of the modules that do not need to check.
  4282. macro NO_CHECK_IMPORTS(Masks...) {
  4283. SET(NO_CHECK_IMPORTS_FOR_VALUE $Masks)
  4284. }
  4285. # tag:yasm-specific
  4286. _YASM_FMT_VALUE=
  4287. _YASM_PLATFORM_FLAGS_VALUE=
  4288. _YASM_PREDEFINED_FLAGS_VALUE=
  4289. when ($OS_DARWIN || $OS_IOS) {
  4290. _YASM_FMT_VALUE=macho
  4291. _YASM_PLATFORM_FLAGS_VALUE=-D DARWIN -D UNIX
  4292. }
  4293. elsewhen ($OS_WINDOWS && $ARCH_X86_64) {
  4294. _YASM_FMT_VALUE=win
  4295. _YASM_PLATFORM_FLAGS_VALUE=-D WIN64
  4296. }
  4297. elsewhen ($OS_WINDOWS && $ARCH_I386) {
  4298. _YASM_FMT_VALUE=win
  4299. _YASM_PLATFORM_FLAGS_VALUE=-D WIN32
  4300. }
  4301. otherwise {
  4302. _YASM_FMT_VALUE=elf
  4303. _YASM_PLATFORM_FLAGS_VALUE=-D UNIX
  4304. _YASM_PREDEFINED_FLAGS_VALUE=-g dwarf2
  4305. }
  4306. when ($ASM_PREFIX) {
  4307. ASM_PREFIX_VALUE=--prefix=$ASM_PREFIX
  4308. }
  4309. otherwise {
  4310. ASM_PREFIX_VALUE=
  4311. }
  4312. # tag:yasm-specific
  4313. YASM_FLAGS=
  4314. YASM_PREINCLUDES_VALUE=
  4315. # tag:yasm-specific
  4316. macro _SRC_yasm_helper(SRC, PREINCLUDES[], SRCFLAGS...) {
  4317. .CMD=${tool:"contrib/tools/yasm"} -f ${_YASM_FMT_VALUE}${HARDWARE_ARCH} $_YASM_PLATFORM_FLAGS_VALUE $YASM_DEBUG_INFO $YASM_DEBUG_INFO_DISABLE_CACHE__NO_UID__ -D ${pre=_;suf=_:HARDWARE_TYPE} -D_YASM_ $ASM_PREFIX_VALUE $_YASM_PREDEFINED_FLAGS_VALUE $YASM_FLAGS ${pre=-I :_ASM__INCLUDE} $SRCFLAGS -o ${output;noext;suf=${OBJECT_SUF}:SRC} ${pre=-P :PREINCLUDES} ${hide;input:PREINCLUDES} ${SRC} ${hide;kv:"p AS"} ${hide;kv:"pc light-green"}
  4318. }
  4319. # tag:yasm-specific
  4320. macro _SRC_yasm(SRC, PREINCLUDES[], SRCFLAGS...) {
  4321. .CMD=$_SRC_yasm_helper(${input:SRC}, $SRCFLAGS, PREINCLUDES $PREINCLUDES)
  4322. }
  4323. # tag:nasm-specific
  4324. NASM_FLAGS=
  4325. # tag:nasm-specific
  4326. macro _SRC_nasm_helper(SRC, SRCFLAGS...) {
  4327. .CMD=${NASM_RESOURCE_GLOBAL}/bin/nasm -f ${_YASM_FMT_VALUE}${HARDWARE_ARCH} -D ${pre=_;suf=_:HARDWARE_TYPE} $NASM_FLAGS ${pre=-I :_ASM__INCLUDE} $SRCFLAGS -o ${output;noext;suf=${OBJECT_SUF}:SRC} ${SRC} ${hide;kv:"p AS"} ${hide;kv:"pc light-green"}
  4328. }
  4329. # tag:nasm-specific
  4330. macro _SRC_nasm(SRC, PREINCLUDES[], SRCFLAGS...) {
  4331. .CMD=$_SRC_nasm_helper(${input:SRC}, $SRCFLAGS)
  4332. }
  4333. # tag:src-processing
  4334. when ($USE_NASM_ASSEMBLER == "yes") {
  4335. _SRC_ASM_CMDLINE=$_SRC_nasm($SRC $SRCFLAGS)
  4336. }
  4337. elsewhen ($USE_YASM_ASSEMBLER == "yes") {
  4338. _SRC_ASM_CMDLINE=$_SRC_yasm($SRC $SRCFLAGS)
  4339. }
  4340. otherwise {
  4341. _SRC_ASM_CMDLINE=
  4342. }
  4343. # tag:src-processing
  4344. macro _SRC_ASM(SRC, SRCFLAGS...) {
  4345. .CMD=$_SRC_ASM_CMDLINE
  4346. }
  4347. ### @usage: ASM_PREINCLUDE(AsmFiles...)
  4348. ###
  4349. ### Supply additional .asm files to all assembler calls within a module
  4350. macro ASM_PREINCLUDE(PREINCLUDES...) {
  4351. SET_APPEND(YASM_PREINCLUDES_VALUE $PREINCLUDES)
  4352. }
  4353. ### @usage: RUN_ANTLR(Args...)
  4354. ###
  4355. ### Macro to invoke ANTLR3 generator (general case)
  4356. macro RUN_ANTLR(IN[], IN_NOPARSE[], OUT[], OUT_NOAUTO[], OUTPUT_INCLUDES[], INDUCED_DEPS[], CWD="", Args...) {
  4357. _RUN_ANTLR_BASE($Args IN $IN IN_NOPARSE $IN_NOPARSE OUT $OUT OUT_NOAUTO $OUT_NOAUTO OUTPUT_INCLUDES $OUTPUT_INCLUDES INDUCED_DEPS $INDUCED_DEPS ${pre=CWD :CWD} JAR -jar ${input:"contrib/java/antlr/antlr3/antlr.jar"} SEM run_antlr)
  4358. }
  4359. ### @usage: RUN_ANTLR4(Args...)
  4360. ###
  4361. ### Macro to invoke ANTLR4 generator (general case)
  4362. macro RUN_ANTLR4(IN[], IN_NOPARSE[], OUT[], OUT_NOAUTO[], OUTPUT_INCLUDES[], INDUCED_DEPS[], CWD="", Args...) {
  4363. _RUN_ANTLR_BASE($Args IN $IN IN_NOPARSE $IN_NOPARSE OUT $OUT OUT_NOAUTO $OUT_NOAUTO OUTPUT_INCLUDES $OUTPUT_INCLUDES INDUCED_DEPS $INDUCED_DEPS ${pre=CWD :CWD} JAR -jar ${input:"contrib/java/antlr/antlr4/antlr.jar"} SEM run_antlr4)
  4364. }
  4365. _ANTLR4_LISTENER_GRAMMAR=-listener
  4366. _ANTLR4_LISTENER_PARSER=-listener
  4367. _ANTLR4_LISTENER__ANTLR4_EMPTY=-no-listener
  4368. _ANTLR4_VISITOR_GRAMMAR=-visitor
  4369. _ANTLR4_VISITOR_PARSER=-visitor
  4370. _ANTLR4_VISITOR__ANTLR4_EMPTY=-no-visitor
  4371. ### @usage: RUN_ANTLR4_CPP_SPLIT(LEXER, PARSER, OUTPUT_INCLUDES, LISTENER, VISITOR, Args...)
  4372. ###
  4373. ### Macro to invoke ANTLR4 generator for separate lexer and parser grammars (Cpp)
  4374. macro RUN_ANTLR4_CPP_SPLIT(LEXER, PARSER, OUTPUT_INCLUDES[], LISTENER?"PARSER":"_ANTLR4_EMPTY", VISITOR?"PARSER":"_ANTLR4_EMPTY", _ANTLR4_EMPTY="", Args...) {
  4375. RUN_ANTLR4(${LEXER} ${PARSER} -Dlanguage=Cpp -o ${BINDIR} ${_ANTLR4_VISITOR_$VISITOR} ${_ANTLR4_LISTENER_$LISTENER} ${Args} CWD ${BINDIR} IN ${LEXER} ${PARSER} OUT ${noext;suf=.cpp:LEXER} ${noext;suf=.h:LEXER} ${noext;suf=.cpp:PARSER} ${noext;suf=.h:PARSER} ${noext;suf=Listener.h:$LISTENER} ${noext;suf=BaseListener.h:$LISTENER} ${noext;suf=Visitor.h:$VISITOR} ${noext;suf=BaseVisitor.h:$VISITOR} OUTPUT_INCLUDES ${ARCADIA_ROOT}/contrib/libs/antlr4_cpp_runtime/src/antlr4-runtime.h ${OUTPUT_INCLUDES})
  4376. PEERDIR(contrib/libs/antlr4_cpp_runtime)
  4377. }
  4378. ### @usage: RUN_ANTLR4_CPP(GRAMMAR, OUTPUT_INCLUDES, LISTENER, VISITOR, Args...)
  4379. ###
  4380. ### Macro to invoke ANTLR4 generator for combined lexer+parser grammars (Cpp)
  4381. macro RUN_ANTLR4_CPP(GRAMMAR, OUTPUT_INCLUDES[], LISTENER?"GRAMMAR":"_ANTLR4_EMPTY", VISITOR?"GRAMMAR":"_ANTLR4_EMPTY", _ANTLR4_EMPTY="", Args...) {
  4382. RUN_ANTLR4(${GRAMMAR} -Dlanguage=Cpp -o ${BINDIR} ${_ANTLR4_VISITOR_$VISITOR} ${_ANTLR4_LISTENER_$LISTENER} ${Args} CWD ${BINDIR} IN ${GRAMMAR} OUT ${noext;suf=Lexer.cpp:GRAMMAR} ${noext;suf=Lexer.h:GRAMMAR} ${noext;suf=Parser.cpp:GRAMMAR} ${noext;suf=Parser.h:GRAMMAR} ${noext;suf=Listener.h:$LISTENER} ${noext;suf=BaseListener.h:$LISTENER} ${noext;suf=Visitor.h:$VISITOR} ${noext;suf=BaseVisitor.h:$VISITOR} OUTPUT_INCLUDES ${ARCADIA_ROOT}/contrib/libs/antlr4_cpp_runtime/src/antlr4-runtime.h ${OUTPUT_INCLUDES})
  4383. PEERDIR(contrib/libs/antlr4_cpp_runtime)
  4384. }
  4385. ### @usage: RUN_ANTLR4_GO(GRAMMAR, DEPS <extra_go_deps>, LISTENER, VISITOR, Args...)
  4386. ###
  4387. ### Macro to invoke ANTLR4 generator (Go)
  4388. macro RUN_ANTLR4_GO(GRAMMAR, DEPS[], LISTENER?"GRAMMAR":"_ANTLR4_EMPTY", VISITOR?"GRAMMAR":"_ANTLR4_EMPTY", _ANTLR4_EMPTY="", Args...) {
  4389. RUN_ANTLR4(${GRAMMAR} -Dlanguage=Go -o ${BINDIR} ${_ANTLR4_VISITOR_$VISITOR} ${_ANTLR4_LISTENER_$LISTENER} ${Args} CWD ${BINDIR} IN ${GRAMMAR} OUT ${noext;tolower;suf=_lexer.go:GRAMMAR} ${noext;tolower;suf=_parser.go:GRAMMAR} ${noext;tolower;suf=_listener.go:$LISTENER} ${noext;tolower;suf=_base_listener.go:$LISTENER} ${noext;tolower;suf=_visitor.go:$VISITOR} ${noext;tolower;suf=_base_visitor.go:$VISITOR})
  4390. PEERDIR(${GOSTD}/fmt ${GOSTD}/reflect ${GOSTD}/strconv ${GOSTD}/sync ${GOSTD}/unicode vendor/github.com/antlr/antlr4/runtime/Go/antlr/v4 $DEPS)
  4391. }
  4392. ### @usage: RUN_ANTLR4_PYTHON(Grammar [LISTENER] [VISITOR] [SUBDIR] [EXTRA_OUTS Outs...] Args...)
  4393. ###
  4394. ### `LISTENER` - emit grammar listener
  4395. ### `VISITOR` - emit grammar visitor
  4396. ### `SUBDIR` - place generated files to specified subdirectory of BINDIR
  4397. ### `EXTRA_OUTS` - list extra outputs produced by Antlr (e.g. .interp and .token files) if they are needed. If `SUBDIR` is specied it will affect these as well. Use file names only.
  4398. ###
  4399. ### Macro to invoke ANTLR4 generator (Python). The Python3 will be used for PY3_LIBRARY/PY3_PROGRAM/PY3TEST, Python2 will be used in all other cases.
  4400. macro RUN_ANTLR4_PYTHON(GRAMMAR, LISTENER?"GRAMMAR":"_ANTLR4_EMPTY", VISITOR?"GRAMMAR":"_ANTLR4_EMPTY", SUBDIR=".", EXTRA_OUTS[], _ANTLR4_EMPTY="", Args...) {
  4401. RUN_ANTLR4(${GRAMMAR} -Dlanguage=$ANTLR_PYTHON -o ${BINDIR}/${SUBDIR} ${_ANTLR4_VISITOR_$VISITOR} ${_ANTLR4_LISTENER_$LISTENER} ${Args} CWD ${BINDIR} IN ${GRAMMAR} OUT_NOAUTO ${nopath;noext;pre=${SUBDIR}/;suf=Lexer.py:GRAMMAR} ${nopath;noext;pre=${SUBDIR}/;suf=Parser.py:GRAMMAR} ${nopath;noext;pre=${SUBDIR}/;suf=Listener.py:$LISTENER} ${nopath;noext;pre=${SUBDIR}/;suf=Visitor.py:$VISITOR} ${pre=${SUBDIR}/:EXTRA_OUTS})
  4402. PEERDIR(contrib/python/antlr4)
  4403. }
  4404. # tag:cpp-specific
  4405. macro CPP_ADDINCL(Dirs...) {
  4406. ADDINCL($Dirs)
  4407. }
  4408. # tag:internal
  4409. _WHOLE_ARCHIVE_PEERS_VALUE=
  4410. ### @usage: WHOLE_ARCHIVE(dirnames...) # internal
  4411. macro WHOLE_ARCHIVE(PEERS...) {
  4412. SET_APPEND(_WHOLE_ARCHIVE_PEERS_VALUE ${PEERS})
  4413. REQUIRES(${PEERS})
  4414. }
  4415. ANDROID_SDK_ROOT=${ANDROID_SDK_RESOURCE_GLOBAL}/android_sdk
  4416. macro TASKLET() {
  4417. PEERDIR(tasklet/v1/api)
  4418. # CPP
  4419. CPP_PROTO_PLUGIN(tasklet_cpp tasklet/v1/gen/cpp .tasklet.h)
  4420. # Python
  4421. PY_PROTO_PLUGIN2(tasklet_py _tasklet.py _sbtask.py tasklet/v1/gen/python DEPS tasklet/v1/domain/sandbox tasklet/v1/runtime sandbox/sdk2)
  4422. }
  4423. TASKLET_REG_INCLUDES= \
  4424. ${hide;output_include:"tasklet/v1/runtime/lib/cpp_wrapper.h"} \
  4425. ${hide;output_include:"tasklet/v1/runtime/lib/go_wrapper.h"} \
  4426. ${hide;output_include:"tasklet/v1/runtime/lib/py_wrapper.h"} \
  4427. ${hide;output_include:"tasklet/v1/runtime/lib/js_wrapper.h"} \
  4428. ${hide;output_include:"tasklet/v1/runtime/lib/registry.h"}
  4429. macro TASKLET_REG(Name, Lang, Impl, Includes...) {
  4430. PEERDIR(tasklet/v1/domain sandbox/bin sandbox/taskbox/worker)
  4431. when($Lang == "js") {
  4432. # JS runtime links the Node.js from contrib as a library, which is a bit heavy,
  4433. # so we do it, only if any JS tasklets are linked into the target
  4434. PEERDIR+=tasklet/v1/runtime/js
  4435. }
  4436. .CMD=$YMAKE_PYTHON ${input:"build/scripts/gen_tasklet_reg.py"} $Name -l $Lang -i $Impl ${noauto;output:Name.task.cpp} $Includes ${hide;output_include:Includes} $TASKLET_REG_INCLUDES ${hide;kv:"p TT"} ${hide;kv:"pc yellow"}
  4437. SRCS(GLOBAL $Name.task.cpp)
  4438. }
  4439. # TEMPORARY METHOD FOR EXTENDED REGISTRY SETUP
  4440. # NOT COMPLETE
  4441. macro TASKLET_REG_EXT(Name, Lang, Impl, Wrapper, Includes...) {
  4442. PEERDIR(tasklet/v1/domain sandbox/bin sandbox/taskbox/worker)
  4443. .CMD=$YMAKE_PYTHON ${input:"build/scripts/gen_tasklet_reg.py"} $Name -l $Lang -i $Impl -w $Wrapper ${noauto;output:Name.task.cpp} $Includes ${hide;output_include:Includes} $TASKLET_REG_INCLUDES ${hide;kv:"p TT"} ${hide;kv:"pc yellow"}
  4444. SRCS(GLOBAL $Name.task.cpp)
  4445. }
  4446. # tag:cpp-specific
  4447. _CPP_PROTO_MODULE_PREFIX=
  4448. _CPP_PROTO_MODULE_SUFFIX=
  4449. when ($MSVC == "yes" || $CYGWIN == "yes") {
  4450. _CPP_PROTO_MODULE_PREFIX=
  4451. _CPP_PROTO_MODULE_SUFFIX=.lib
  4452. }
  4453. otherwise {
  4454. _CPP_PROTO_MODULE_PREFIX=lib
  4455. _CPP_PROTO_MODULE_SUFFIX=.a
  4456. }
  4457. ### @usage: _EXPOSE(OutputsToExport...)
  4458. ###
  4459. ### Allows to mark outputs of macro command as unused in the current module but intended
  4460. ### to be used in modules consuming current via PEERDIR.
  4461. ###
  4462. ### TODO(DEVTOOLS-9000) proper implementation needed
  4463. macro _EXPOSE(Args...) {
  4464. .CMD=$YMAKE_PYTHON ${input:"build/scripts/touch.py"} ${output;suf=$_HASH_HELPER($Args).ya_exposed:"empty_"} ${hide;input:Args}
  4465. }
  4466. # tag:internal
  4467. ### @usage: _PROXY_LIBRARY() # internal
  4468. ###
  4469. ### The use of this module is strictly prohibited!!!
  4470. module _PROXY_LIBRARY: LIBRARY {
  4471. .EXTS=.a .lib
  4472. .PEERDIR_POLICY=as_build_from
  4473. .PROXY=yes
  4474. .FINAL_TARGET=yes
  4475. DISABLE(NEED_ADD_FAKE_SRC)
  4476. NO_UTIL()
  4477. NO_RUNTIME()
  4478. }
  4479. @import "${CONF_ROOT}/conf/project_specific/yql_udf.conf"
  4480. _PRIMARY_OUTPUT_VALUE=
  4481. # tag:internal
  4482. ### @usage: PRIMARY_OUTPUT_VALUE(Output) # internal
  4483. ###
  4484. ### The use of this module is strictly prohibited!!!
  4485. macro PRIMARY_OUTPUT(OUTPUT) {
  4486. SET(_PRIMARY_OUTPUT_VALUE $OUTPUT)
  4487. }
  4488. _DLL_PROXY_LIBRARY_CMD=$GENERATE_MF && $COPY_CMD $_PRIMARY_OUTPUT_VALUE ${hide;input:_PRIMARY_OUTPUT_VALUE} ${TARGET}
  4489. # tag:internal
  4490. ### @usage: DLL_PROXY_LIBRARY() # internal
  4491. ###
  4492. ### The use of this module is strictly prohibited!!!
  4493. module DLL_PROXY_LIBRARY: _PROXY_LIBRARY {
  4494. .ALLOWED=PRIMARY_OUTPUT
  4495. .CMD=$_DLL_PROXY_LIBRARY_CMD
  4496. }
  4497. _PREBUILT_PROGRAM_CMD=$GENERATE_MF && $COPY_CMD $_PRIMARY_OUTPUT_VALUE ${TARGET} ${hide;kv:"p ld"} ${hide;kv:"pc light-blue"} ${hide;kv:"show_out"}
  4498. # tag:internal
  4499. ### @usage: PREBUILT_PROGRAM([programname]) # internal
  4500. ###
  4501. ### Program module which uses a prebuilt prgram as its output.
  4502. module PREBUILT_PROGRAM: _LINK_UNIT {
  4503. .CMD=$_PREBUILT_PROGRAM_CMD
  4504. .SYMLINK_POLICY=EXE
  4505. .ALLOWED=INDUCED_DEPS PRIMARY_OUTPUT
  4506. .RESTRICTED=SRCS
  4507. _BARE_LINK_MODULE()
  4508. SET(MODULE_TYPE PROGRAM)
  4509. _DONT_REQUIRE_LICENSE()
  4510. WITHOUT_VERSION()
  4511. when ($WIN32 == "yes" || $OS_CYGWIN == "yes") {
  4512. MODULE_SUFFIX=.exe
  4513. }
  4514. }
  4515. ### @usage: COLLECT_JINJA_TEMPLATES(varname path)
  4516. ###
  4517. ### This macro collects all jinja and yaml files in the directory specified by second argument and
  4518. ### stores result in the variable with mane specified by first parameter.
  4519. macro COLLECT_JINJA_TEMPLATES(VAR, DIR) {
  4520. _GLOB($VAR ${DIR}/**/*.jinja ${DIR}/**/*.yaml)
  4521. }
  4522. @import "${CONF_ROOT}/conf/go.conf"
  4523. # Conflict between protobuf-java and protobuf-javalite ¯\_(ツ)_/¯
  4524. # both libraries are required by grpc
  4525. JAVA_IGNORE_CLASSPATH_CLASH_DEFAULE_VALUE=\
  4526. com.google.protobuf.AbstractMessageLite \
  4527. com.google.protobuf.AbstractMessageLite$Builder \
  4528. com.google.protobuf.AbstractMessageLite$Builder$LimitedInputStream \
  4529. com.google.protobuf.AbstractMessageLite$InternalOneOfEnum \
  4530. com.google.protobuf.AbstractParser \
  4531. com.google.protobuf.AbstractProtobufList \
  4532. com.google.protobuf.AllocatedBuffer \
  4533. com.google.protobuf.AllocatedBuffer$1 \
  4534. com.google.protobuf.AllocatedBuffer$2 \
  4535. com.google.protobuf.Android \
  4536. com.google.protobuf.Any \
  4537. com.google.protobuf.Any$1 \
  4538. com.google.protobuf.Any$Builder \
  4539. com.google.protobuf.AnyOrBuilder \
  4540. com.google.protobuf.AnyProto \
  4541. com.google.protobuf.Api \
  4542. com.google.protobuf.Api$1 \
  4543. com.google.protobuf.Api$Builder \
  4544. com.google.protobuf.ApiOrBuilder \
  4545. com.google.protobuf.ApiProto \
  4546. com.google.protobuf.ArrayDecoders \
  4547. com.google.protobuf.ArrayDecoders$1 \
  4548. com.google.protobuf.ArrayDecoders$Registers \
  4549. com.google.protobuf.BinaryReader \
  4550. com.google.protobuf.BinaryReader$1 \
  4551. com.google.protobuf.BinaryReader$SafeHeapReader \
  4552. com.google.protobuf.BinaryWriter \
  4553. com.google.protobuf.BinaryWriter$1 \
  4554. com.google.protobuf.BinaryWriter$SafeDirectWriter \
  4555. com.google.protobuf.BinaryWriter$SafeHeapWriter \
  4556. com.google.protobuf.BinaryWriter$UnsafeDirectWriter \
  4557. com.google.protobuf.BinaryWriter$UnsafeHeapWriter \
  4558. com.google.protobuf.BooleanArrayList \
  4559. com.google.protobuf.BoolValue \
  4560. com.google.protobuf.BoolValue$1 \
  4561. com.google.protobuf.BoolValue$Builder \
  4562. com.google.protobuf.BoolValueOrBuilder \
  4563. com.google.protobuf.BufferAllocator \
  4564. com.google.protobuf.BufferAllocator$1 \
  4565. com.google.protobuf.ByteBufferWriter \
  4566. com.google.protobuf.ByteOutput \
  4567. com.google.protobuf.ByteString \
  4568. com.google.protobuf.ByteString$1 \
  4569. com.google.protobuf.ByteString$2 \
  4570. com.google.protobuf.ByteString$AbstractByteIterator \
  4571. com.google.protobuf.ByteString$ArraysByteArrayCopier \
  4572. com.google.protobuf.ByteString$BoundedByteString \
  4573. com.google.protobuf.ByteString$ByteArrayCopier \
  4574. com.google.protobuf.ByteString$ByteIterator \
  4575. com.google.protobuf.ByteString$CodedBuilder \
  4576. com.google.protobuf.ByteString$LeafByteString \
  4577. com.google.protobuf.ByteString$LiteralByteString \
  4578. com.google.protobuf.ByteString$Output \
  4579. com.google.protobuf.ByteString$SystemByteArrayCopier \
  4580. com.google.protobuf.BytesValue \
  4581. com.google.protobuf.BytesValue$1 \
  4582. com.google.protobuf.BytesValue$Builder \
  4583. com.google.protobuf.BytesValueOrBuilder \
  4584. com.google.protobuf.CanIgnoreReturnValue \
  4585. com.google.protobuf.CheckReturnValue \
  4586. com.google.protobuf.CodedInputStream \
  4587. com.google.protobuf.CodedInputStream$1 \
  4588. com.google.protobuf.CodedInputStream$ArrayDecoder \
  4589. com.google.protobuf.CodedInputStream$IterableDirectByteBufferDecoder \
  4590. com.google.protobuf.CodedInputStream$StreamDecoder \
  4591. com.google.protobuf.CodedInputStream$StreamDecoder$RefillCallback \
  4592. com.google.protobuf.CodedInputStream$StreamDecoder$SkippedDataSink \
  4593. com.google.protobuf.CodedInputStream$UnsafeDirectNioDecoder \
  4594. com.google.protobuf.CodedInputStreamReader \
  4595. com.google.protobuf.CodedInputStreamReader$1 \
  4596. com.google.protobuf.CodedOutputStream \
  4597. com.google.protobuf.CodedOutputStream$1 \
  4598. com.google.protobuf.CodedOutputStream$AbstractBufferedEncoder \
  4599. com.google.protobuf.CodedOutputStream$ArrayEncoder \
  4600. com.google.protobuf.CodedOutputStream$ByteOutputEncoder \
  4601. com.google.protobuf.CodedOutputStream$HeapNioEncoder \
  4602. com.google.protobuf.CodedOutputStream$OutOfSpaceException \
  4603. com.google.protobuf.CodedOutputStream$OutputStreamEncoder \
  4604. com.google.protobuf.CodedOutputStream$SafeDirectNioEncoder \
  4605. com.google.protobuf.CodedOutputStream$UnsafeDirectNioEncoder \
  4606. com.google.protobuf.CodedOutputStreamWriter \
  4607. com.google.protobuf.CodedOutputStreamWriter$1 \
  4608. com.google.protobuf.DoubleArrayList \
  4609. com.google.protobuf.DoubleValue \
  4610. com.google.protobuf.DoubleValue$1 \
  4611. com.google.protobuf.DoubleValue$Builder \
  4612. com.google.protobuf.DoubleValueOrBuilder \
  4613. com.google.protobuf.Duration \
  4614. com.google.protobuf.Duration$1 \
  4615. com.google.protobuf.Duration$Builder \
  4616. com.google.protobuf.DurationOrBuilder \
  4617. com.google.protobuf.DurationProto \
  4618. com.google.protobuf.Empty \
  4619. com.google.protobuf.Empty$1 \
  4620. com.google.protobuf.Empty$Builder \
  4621. com.google.protobuf.EmptyOrBuilder \
  4622. com.google.protobuf.EmptyProto \
  4623. com.google.protobuf.Enum \
  4624. com.google.protobuf.Enum$1 \
  4625. com.google.protobuf.Enum$Builder \
  4626. com.google.protobuf.EnumOrBuilder \
  4627. com.google.protobuf.EnumValue \
  4628. com.google.protobuf.EnumValue$1 \
  4629. com.google.protobuf.EnumValue$Builder \
  4630. com.google.protobuf.EnumValueOrBuilder \
  4631. com.google.protobuf.ExperimentalApi \
  4632. com.google.protobuf.ExtensionLite \
  4633. com.google.protobuf.ExtensionRegistryFactory \
  4634. com.google.protobuf.ExtensionRegistryLite \
  4635. com.google.protobuf.ExtensionRegistryLite$ExtensionClassHolder \
  4636. com.google.protobuf.ExtensionRegistryLite$ObjectIntPair \
  4637. com.google.protobuf.ExtensionSchema \
  4638. com.google.protobuf.ExtensionSchemaLite \
  4639. com.google.protobuf.ExtensionSchemaLite$1 \
  4640. com.google.protobuf.ExtensionSchemas \
  4641. com.google.protobuf.Field \
  4642. com.google.protobuf.Field$1 \
  4643. com.google.protobuf.Field$Builder \
  4644. com.google.protobuf.Field$Cardinality \
  4645. com.google.protobuf.Field$Cardinality$1 \
  4646. com.google.protobuf.Field$Kind \
  4647. com.google.protobuf.Field$Kind$1 \
  4648. com.google.protobuf.FieldInfo \
  4649. com.google.protobuf.FieldInfo$1 \
  4650. com.google.protobuf.FieldInfo$Builder \
  4651. com.google.protobuf.FieldMask \
  4652. com.google.protobuf.FieldMask$1 \
  4653. com.google.protobuf.FieldMask$Builder \
  4654. com.google.protobuf.FieldMaskOrBuilder \
  4655. com.google.protobuf.FieldMaskProto \
  4656. com.google.protobuf.FieldOrBuilder \
  4657. com.google.protobuf.FieldSet \
  4658. com.google.protobuf.FieldSet$1 \
  4659. com.google.protobuf.FieldSet$Builder \
  4660. com.google.protobuf.FieldSet$FieldDescriptorLite \
  4661. com.google.protobuf.FieldType \
  4662. com.google.protobuf.FieldType$1 \
  4663. com.google.protobuf.FieldType$Collection \
  4664. com.google.protobuf.FloatArrayList \
  4665. com.google.protobuf.FloatValue \
  4666. com.google.protobuf.FloatValue$1 \
  4667. com.google.protobuf.FloatValue$Builder \
  4668. com.google.protobuf.FloatValueOrBuilder \
  4669. com.google.protobuf.GeneratedMessageInfoFactory \
  4670. com.google.protobuf.GeneratedMessageLite \
  4671. com.google.protobuf.GeneratedMessageLite$1 \
  4672. com.google.protobuf.GeneratedMessageLite$Builder \
  4673. com.google.protobuf.GeneratedMessageLite$DefaultInstanceBasedParser \
  4674. com.google.protobuf.GeneratedMessageLite$ExtendableBuilder \
  4675. com.google.protobuf.GeneratedMessageLite$ExtendableMessage \
  4676. com.google.protobuf.GeneratedMessageLite$ExtendableMessage$ExtensionWriter \
  4677. com.google.protobuf.GeneratedMessageLite$ExtendableMessageOrBuilder \
  4678. com.google.protobuf.GeneratedMessageLite$ExtensionDescriptor \
  4679. com.google.protobuf.GeneratedMessageLite$GeneratedExtension \
  4680. com.google.protobuf.GeneratedMessageLite$MethodToInvoke \
  4681. com.google.protobuf.GeneratedMessageLite$SerializedForm \
  4682. com.google.protobuf.Int32Value \
  4683. com.google.protobuf.Int32Value$1 \
  4684. com.google.protobuf.Int32Value$Builder \
  4685. com.google.protobuf.Int32ValueOrBuilder \
  4686. com.google.protobuf.Int64Value \
  4687. com.google.protobuf.Int64Value$1 \
  4688. com.google.protobuf.Int64Value$Builder \
  4689. com.google.protobuf.Int64ValueOrBuilder \
  4690. com.google.protobuf.IntArrayList \
  4691. com.google.protobuf.Internal \
  4692. com.google.protobuf.Internal$BooleanList \
  4693. com.google.protobuf.Internal$DoubleList \
  4694. com.google.protobuf.Internal$EnumLite \
  4695. com.google.protobuf.Internal$EnumLiteMap \
  4696. com.google.protobuf.Internal$EnumVerifier \
  4697. com.google.protobuf.Internal$FloatList \
  4698. com.google.protobuf.Internal$IntList \
  4699. com.google.protobuf.Internal$ListAdapter \
  4700. com.google.protobuf.Internal$ListAdapter$Converter \
  4701. com.google.protobuf.Internal$LongList \
  4702. com.google.protobuf.Internal$MapAdapter \
  4703. com.google.protobuf.Internal$MapAdapter$1 \
  4704. com.google.protobuf.Internal$MapAdapter$Converter \
  4705. com.google.protobuf.Internal$MapAdapter$EntryAdapter \
  4706. com.google.protobuf.Internal$MapAdapter$IteratorAdapter \
  4707. com.google.protobuf.Internal$MapAdapter$SetAdapter \
  4708. com.google.protobuf.Internal$ProtobufList \
  4709. com.google.protobuf.InvalidProtocolBufferException \
  4710. com.google.protobuf.InvalidProtocolBufferException$InvalidWireTypeException \
  4711. com.google.protobuf.IterableByteBufferInputStream \
  4712. com.google.protobuf.JavaType \
  4713. com.google.protobuf.LazyField \
  4714. com.google.protobuf.LazyField$1 \
  4715. com.google.protobuf.LazyField$LazyEntry \
  4716. com.google.protobuf.LazyField$LazyIterator \
  4717. com.google.protobuf.LazyFieldLite \
  4718. com.google.protobuf.LazyStringArrayList \
  4719. com.google.protobuf.LazyStringArrayList$ByteArrayListView \
  4720. com.google.protobuf.LazyStringArrayList$ByteStringListView \
  4721. com.google.protobuf.LazyStringList \
  4722. com.google.protobuf.ListFieldSchema \
  4723. com.google.protobuf.ListFieldSchema$1 \
  4724. com.google.protobuf.ListFieldSchema$ListFieldSchemaFull \
  4725. com.google.protobuf.ListFieldSchema$ListFieldSchemaLite \
  4726. com.google.protobuf.ListValue \
  4727. com.google.protobuf.ListValue$1 \
  4728. com.google.protobuf.ListValue$Builder \
  4729. com.google.protobuf.ListValueOrBuilder \
  4730. com.google.protobuf.LongArrayList \
  4731. com.google.protobuf.ManifestSchemaFactory \
  4732. com.google.protobuf.ManifestSchemaFactory$1 \
  4733. com.google.protobuf.ManifestSchemaFactory$CompositeMessageInfoFactory \
  4734. com.google.protobuf.MapEntryLite \
  4735. com.google.protobuf.MapEntryLite$1 \
  4736. com.google.protobuf.MapEntryLite$Metadata \
  4737. com.google.protobuf.MapFieldLite \
  4738. com.google.protobuf.MapFieldSchema \
  4739. com.google.protobuf.MapFieldSchemaLite \
  4740. com.google.protobuf.MapFieldSchemas \
  4741. com.google.protobuf.MessageInfo \
  4742. com.google.protobuf.MessageInfoFactory \
  4743. com.google.protobuf.MessageLite \
  4744. com.google.protobuf.MessageLite$Builder \
  4745. com.google.protobuf.MessageLiteOrBuilder \
  4746. com.google.protobuf.MessageLiteToString \
  4747. com.google.protobuf.MessageSchema \
  4748. com.google.protobuf.MessageSchema$1 \
  4749. com.google.protobuf.MessageSetSchema \
  4750. com.google.protobuf.Method \
  4751. com.google.protobuf.Method$1 \
  4752. com.google.protobuf.Method$Builder \
  4753. com.google.protobuf.MethodOrBuilder \
  4754. com.google.protobuf.Mixin \
  4755. com.google.protobuf.Mixin$1 \
  4756. com.google.protobuf.Mixin$Builder \
  4757. com.google.protobuf.MixinOrBuilder \
  4758. com.google.protobuf.MutabilityOracle \
  4759. com.google.protobuf.MutabilityOracle$1 \
  4760. com.google.protobuf.NewInstanceSchema \
  4761. com.google.protobuf.NewInstanceSchemaLite \
  4762. com.google.protobuf.NewInstanceSchemas \
  4763. com.google.protobuf.NioByteString \
  4764. com.google.protobuf.NioByteString$1 \
  4765. com.google.protobuf.NullValue \
  4766. com.google.protobuf.NullValue$1 \
  4767. com.google.protobuf.OneofInfo \
  4768. com.google.protobuf.Option \
  4769. com.google.protobuf.Option$1 \
  4770. com.google.protobuf.Option$Builder \
  4771. com.google.protobuf.OptionOrBuilder \
  4772. com.google.protobuf.Parser \
  4773. com.google.protobuf.PrimitiveNonBoxingCollection \
  4774. com.google.protobuf.Protobuf \
  4775. com.google.protobuf.ProtobufArrayList \
  4776. com.google.protobuf.ProtobufLists \
  4777. com.google.protobuf.ProtocolStringList \
  4778. com.google.protobuf.ProtoSyntax \
  4779. com.google.protobuf.RawMessageInfo \
  4780. com.google.protobuf.Reader \
  4781. com.google.protobuf.RopeByteString \
  4782. com.google.protobuf.RopeByteString$1 \
  4783. com.google.protobuf.RopeByteString$Balancer \
  4784. com.google.protobuf.RopeByteString$PieceIterator \
  4785. com.google.protobuf.RopeByteString$RopeInputStream \
  4786. com.google.protobuf.Schema \
  4787. com.google.protobuf.SchemaFactory \
  4788. com.google.protobuf.SchemaUtil \
  4789. com.google.protobuf.SmallSortedMap \
  4790. com.google.protobuf.SmallSortedMap$1 \
  4791. com.google.protobuf.SmallSortedMap$DescendingEntryIterator \
  4792. com.google.protobuf.SmallSortedMap$DescendingEntrySet \
  4793. com.google.protobuf.SmallSortedMap$EmptySet \
  4794. com.google.protobuf.SmallSortedMap$EmptySet$1 \
  4795. com.google.protobuf.SmallSortedMap$EmptySet$2 \
  4796. com.google.protobuf.SmallSortedMap$Entry \
  4797. com.google.protobuf.SmallSortedMap$EntryIterator \
  4798. com.google.protobuf.SmallSortedMap$EntrySet \
  4799. com.google.protobuf.SourceContext \
  4800. com.google.protobuf.SourceContext$1 \
  4801. com.google.protobuf.SourceContext$Builder \
  4802. com.google.protobuf.SourceContextOrBuilder \
  4803. com.google.protobuf.SourceContextProto \
  4804. com.google.protobuf.StringValue \
  4805. com.google.protobuf.StringValue$1 \
  4806. com.google.protobuf.StringValue$Builder \
  4807. com.google.protobuf.StringValueOrBuilder \
  4808. com.google.protobuf.Struct \
  4809. com.google.protobuf.Struct$1 \
  4810. com.google.protobuf.Struct$Builder \
  4811. com.google.protobuf.Struct$FieldsDefaultEntryHolder \
  4812. com.google.protobuf.StructOrBuilder \
  4813. com.google.protobuf.StructProto \
  4814. com.google.protobuf.StructuralMessageInfo \
  4815. com.google.protobuf.StructuralMessageInfo$Builder \
  4816. com.google.protobuf.Syntax \
  4817. com.google.protobuf.Syntax$1 \
  4818. com.google.protobuf.TextFormatEscaper \
  4819. com.google.protobuf.TextFormatEscaper$1 \
  4820. com.google.protobuf.TextFormatEscaper$2 \
  4821. com.google.protobuf.TextFormatEscaper$ByteSequence \
  4822. com.google.protobuf.Timestamp \
  4823. com.google.protobuf.Timestamp$1 \
  4824. com.google.protobuf.Timestamp$Builder \
  4825. com.google.protobuf.TimestampOrBuilder \
  4826. com.google.protobuf.TimestampProto \
  4827. com.google.protobuf.Type \
  4828. com.google.protobuf.Type$1 \
  4829. com.google.protobuf.Type$Builder \
  4830. com.google.protobuf.TypeOrBuilder \
  4831. com.google.protobuf.TypeProto \
  4832. com.google.protobuf.UInt32Value \
  4833. com.google.protobuf.UInt32Value$1 \
  4834. com.google.protobuf.UInt32Value$Builder \
  4835. com.google.protobuf.UInt32ValueOrBuilder \
  4836. com.google.protobuf.UInt64Value \
  4837. com.google.protobuf.UInt64Value$1 \
  4838. com.google.protobuf.UInt64Value$Builder \
  4839. com.google.protobuf.UInt64ValueOrBuilder \
  4840. com.google.protobuf.UninitializedMessageException \
  4841. com.google.protobuf.UnknownFieldSchema \
  4842. com.google.protobuf.UnknownFieldSetLite \
  4843. com.google.protobuf.UnknownFieldSetLiteSchema \
  4844. com.google.protobuf.UnmodifiableLazyStringList \
  4845. com.google.protobuf.UnmodifiableLazyStringList$1 \
  4846. com.google.protobuf.UnmodifiableLazyStringList$2 \
  4847. com.google.protobuf.UnsafeByteOperations \
  4848. com.google.protobuf.UnsafeUtil \
  4849. com.google.protobuf.UnsafeUtil$1 \
  4850. com.google.protobuf.UnsafeUtil$Android32MemoryAccessor \
  4851. com.google.protobuf.UnsafeUtil$Android64MemoryAccessor \
  4852. com.google.protobuf.UnsafeUtil$JvmMemoryAccessor \
  4853. com.google.protobuf.UnsafeUtil$MemoryAccessor \
  4854. com.google.protobuf.Utf8 \
  4855. com.google.protobuf.Utf8$DecodeUtil \
  4856. com.google.protobuf.Utf8$Processor \
  4857. com.google.protobuf.Utf8$SafeProcessor \
  4858. com.google.protobuf.Utf8$UnpairedSurrogateException \
  4859. com.google.protobuf.Utf8$UnsafeProcessor \
  4860. com.google.protobuf.Value \
  4861. com.google.protobuf.Value$1 \
  4862. com.google.protobuf.Value$Builder \
  4863. com.google.protobuf.Value$KindCase \
  4864. com.google.protobuf.ValueOrBuilder \
  4865. com.google.protobuf.WireFormat \
  4866. com.google.protobuf.WireFormat$1 \
  4867. com.google.protobuf.WireFormat$FieldType \
  4868. com.google.protobuf.WireFormat$FieldType$1 \
  4869. com.google.protobuf.WireFormat$FieldType$2 \
  4870. com.google.protobuf.WireFormat$FieldType$3 \
  4871. com.google.protobuf.WireFormat$FieldType$4 \
  4872. com.google.protobuf.WireFormat$JavaType \
  4873. com.google.protobuf.WireFormat$Utf8Validation \
  4874. com.google.protobuf.WireFormat$Utf8Validation$1 \
  4875. com.google.protobuf.WireFormat$Utf8Validation$2 \
  4876. com.google.protobuf.WireFormat$Utf8Validation$3 \
  4877. com.google.protobuf.WrappersProto \
  4878. com.google.protobuf.Writer \
  4879. com.google.protobuf.Writer$FieldOrder
  4880. # tag:java-specific
  4881. JAVA_IGNORE_CLASSPATH_CLASH_VALUE=$JAVA_IGNORE_CLASSPATH_CLASH_DEFAULE_VALUE
  4882. ### @usage: JAVA_IGNORE_CLASSPATH_CLASH_FOR([classes])
  4883. ### Ignore classpath clash test fails for classes
  4884. macro JAVA_IGNORE_CLASSPATH_CLASH_FOR(Args...) {
  4885. SET_APPEND(JAVA_IGNORE_CLASSPATH_CLASH_VALUE $Args $JAVA_IGNORE_CLASSPATH_CLASH_DEFAULE_VALUE)
  4886. }
  4887. IBTOOL_PATH=$XCODE_TOOLS_ROOT_RESOURCE_GLOBAL/Xcode/Contents/Developer/usr/bin/ibtool
  4888. # tag:src-processing
  4889. STORYBOARD_FLAGS=--errors --warnings --notices --auto-activate-custom-fonts --output-format human-readable-text
  4890. macro _SRC("storyboard", SRC, SRCFLAGS...) {
  4891. .CMD=$IBTOOL_PATH $STORYBOARD_FLAGS --module $REALPRJNAME --output-partial-info-plist ${output;suf=.partial_plist:SRC} --compilation-directory $BINDIR ${input:SRC} && $YMAKE_PYTHON ${input:"build/scripts/tar_directory.py"} ${output;tobindir;suf=.compiled_storyboard_tar:SRC} $BINDIR/${nopath;suf=c:SRC} $BINDIR/${nopath;suf=c:SRC}
  4892. }
  4893. # tag:src-processing
  4894. macro _SRC("xib", SRC, SRCFLAGS...) {
  4895. .CMD=$IBTOOL_PATH $STORYBOARD_FLAGS --module $REALPRJNAME --output-partial-info-plist ${output;suf=.partial_plist:SRC} --compile ${output;tobindir;nopath;noext;suf=.nib:SRC} ${input:SRC}
  4896. }
  4897. # tag:src-processing
  4898. macro _SRC("msg", SRC, SRCFLAGS...) {
  4899. .CMD=$ROS_MSG_CMD($SRC)
  4900. }
  4901. # tag:src-processing
  4902. macro _SRC("srv", SRC, SRCFLAGS...) {
  4903. .CMD=$ROS_SRV_CMD($SRC)
  4904. }
  4905. ACTOOL_PATH=$XCODE_TOOLS_ROOT_RESOURCE_GLOBAL/Xcode/Contents/Developer/usr/bin/ibtool
  4906. # tag:ios-specific
  4907. ASSETS_FLAGS=--output-format human-readable-text --notices --warnings
  4908. macro _IOS_ASSETS(AssetsDir, Content...) {
  4909. .CMD=$FS_TOOLS md $BINDIR/$REALPRJNAME && $ACTOOL_PATH $ASSETS_FLAGS --export-dependency-info $BINDIR/assetcatalog_dependencies --output-partial-info-plist ${output:"assetcatalog_generated_info.partial_plist"} --product-type com.apple.product-type.application --compile $BINDIR/$REALPRJNAME $AssetsDir ${hide;input:Content} && ${cwd:BINDIR} $YMAKE_PYTHON ${input:"build/scripts/tar_directory.py"} ${output;suf=_assetes.resource_tar:REALPRJNAME} $REALPRJNAME $REALPRJNAME
  4910. }
  4911. # tag:ios-specific
  4912. macro IOS_APP_COMMON_FLAGS(Flags...) {
  4913. SET_APPEND(STORYBOARD_FLAGS $Flags)
  4914. SET_APPEND(ASSETS_FLAGS $Flags)
  4915. }
  4916. # tag:ios-specific
  4917. macro IOS_APP_ASSETS_FLAGS(Flags...) {
  4918. SET_APPEND(ASSETS_FLAGS $Flags)
  4919. }
  4920. macro DARWIN_STRINGS_RESOURCE(Resource, Relpath) {
  4921. .CMD=$COPY_CMD ${input:Resource} $BINDIR/$Relpath && $YMAKE_PYTHON ${input:"build/scripts/tar_directory.py"} ${output;tobindir;suf=.strings_tar:Relpath} $BINDIR/$Relpath $BINDIR
  4922. }
  4923. macro DARWIN_SIGNED_RESOURCE(Resource, Relpath) {
  4924. .CMD=$COPY_CMD $Resource $BINDIR/$Relpath && $YMAKE_PYTHON ${input:"build/scripts/tar_directory.py"} ${output;tobindir;suf=.signed_resource_tar:Relpath} $BINDIR/$Relpath $BINDIR
  4925. }
  4926. # tag:ios-specific
  4927. DELIM=__DELIM__
  4928. PACK_IOS_ARCHIVE=$GENERATE_MF && $YMAKE_PYTHON ${input:"build/scripts/ios_wrapper.py"} bin $IBTOOL_PATH $TARGET $REALPRJNAME $BINDIR $DELIM $AUTO_INPUT $DELIM $STORYBOARD_FLAGS
  4929. ### @usage: IOS_INTERFACE()
  4930. ### iOS GUI module definition
  4931. module IOS_INTERFACE: _BARE_UNIT {
  4932. .CMD=PACK_IOS_ARCHIVE
  4933. .EXTS=.compiled_storyboard_tar .partial_plist .plist .xcent .nib .resource_tar .signed_resource_tar .strings_tar .plist_json
  4934. .NODE_TYPE=Library
  4935. .FINAL_TARGET=no
  4936. SET(MODULE_SUFFIX .ios.interface)
  4937. PEERDIR+=build/platform/xcode/tools
  4938. }
  4939. # tag:ios-specific
  4940. module DEFAULT_IOS_INTERFACE: IOS_INTERFACE {
  4941. SET(MODULE_SUFFIX .default.ios.interface)
  4942. }
  4943. DEFAULT_IOS_TYPE=
  4944. IOS_TYPE=
  4945. when(!$IOS_TYPE) {
  4946. when($DEFAULT_IOS_TYPE) {
  4947. IOS_TYPE=$DEFAULT_IOS_TYPE
  4948. }
  4949. otherwise {
  4950. IOS_TYPE=com.apple.CoreSimulator.SimDeviceType.iPhone-X
  4951. }
  4952. }
  4953. DEFAULT_IOS_RUNTIME=
  4954. IOS_RUNTIME=
  4955. when(!$IOS_RUNTIME) {
  4956. when($DEFAULT_IOS_RUNTIME) {
  4957. IOS_RUNTIME=$DEFAULT_IOS_RUNTIME
  4958. }
  4959. otherwise {
  4960. IOS_RUNTIME=com.apple.CoreSimulator.SimRuntime.iOS-12-1
  4961. }
  4962. }
  4963. when ($ARCH_I386) {
  4964. TEST_IOS_DEVICE_TYPE_VALUE=com.apple.CoreSimulator.SimDeviceType.iPhone-5
  4965. TEST_IOS_RUNTIME_TYPE_VALUE=com.apple.CoreSimulator.SimRuntime.iOS-10-3
  4966. }
  4967. otherwise {
  4968. TEST_IOS_DEVICE_TYPE_VALUE=$IOS_TYPE
  4969. TEST_IOS_RUNTIME_TYPE_VALUE=$IOS_RUNTIME
  4970. }
  4971. # tag:frontend-specific
  4972. ### @usage: COLLECT_FRONTEND_FILES(Varname, Dir)
  4973. ###
  4974. ### Recursively collect files with typical frontend extensions from Dir and save the result into variable Varname
  4975. macro COLLECT_FRONTEND_FILES(Varname, Dir) {
  4976. _GLOB($Varname $Dir/**/*.(css|ejs|jpg|js|jsx|png|styl|svg|ts|tsx|json|html))
  4977. }
  4978. ### @usage: COLLECT_YAML_CONFIG_FILES(Varname, Dir)
  4979. ###
  4980. ### Recursively collect YAML files except for system-reserved a.yaml ones from Dir and save the result into Varname variable
  4981. macro COLLECT_YAML_CONFIG_FILES(Varname, Dir) {
  4982. _GLOB($Varname $Dir/**/*.yaml EXCLUDE **/a.yaml)
  4983. }
  4984. TEST_TOOL_HOST_LOCAL=
  4985. TEST_TOOL_TARGET_LOCAL=
  4986. when ($MOST_USED_CUDA) {
  4987. CUDA12=yes
  4988. }
  4989. CUDA_VERSION=0
  4990. when ($CUDA11) {
  4991. CUDA_VERSION=11.4
  4992. CUDNN_VERSION=8.0.5
  4993. TENSORRT_VERSION=7
  4994. NVCC_STD_VER=17
  4995. }
  4996. when ($CUDA12) {
  4997. CUDA_VERSION=12.6
  4998. CUDNN_VERSION=8.6.0
  4999. TENSORRT_VERSION=8
  5000. CUDA_ARCHITECTURES=
  5001. NVCC_STD_VER=20
  5002. }
  5003. when ($TENSORFLOW_WITH_CUDA) {
  5004. CUDA_REQUIRED=yes
  5005. }
  5006. when (!$TENSORRT_VERSION) {
  5007. TENSORRT_VERSION=5
  5008. }
  5009. ANDROID_APK_TEST_ACTIVITY_VALUE=com.yandex.test.unittests/.RunTestsActivity
  5010. # tag:windows-specific
  5011. WINDOWS_MANIFEST=
  5012. macro WINDOWS_MANIFEST(Manifest) {
  5013. SET(WINDOWS_MANIFEST $Manifest)
  5014. }
  5015. # https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation#enable-long-paths-in-windows-10-version-1607-and-later
  5016. macro WINDOWS_LONG_PATH_MANIFEST() {
  5017. SET(WINDOWS_MANIFEST build/long-path.manifest)
  5018. }
  5019. # tag:windows-specific
  5020. when ($MSVC == "yes" && $WINDOWS_MANIFEST) {
  5021. LDFLAGS+=/MANIFEST:EMBED /MANIFESTINPUT:${input:WINDOWS_MANIFEST}
  5022. }
  5023. # tag:cpp-specific
  5024. _VISIBILITY_LEVEL=
  5025. ### @usage: VISIBILITY(level)
  5026. ###
  5027. ### This macro sets visibility level for symbols compiled for the current module. 'level'
  5028. ### may take only one of the following values: DEFAULT, HIDDEN.
  5029. macro VISIBILITY(LEVEL) {
  5030. SET(_VISIBILITY_LEVEL ${LEVEL})
  5031. select ($LEVEL) {
  5032. "DEFAULT" | "HIDDEN" ? {
  5033. }
  5034. default ? {
  5035. _OK = no
  5036. }
  5037. }
  5038. ASSERT(_OK Unsupported value [$LEVEL] passed to VISIBILITY macro, expected values are DEFAULT, HIDDEN.)
  5039. }
  5040. # tag:cpp-specific
  5041. _CFLAGS_VISIBILITY=
  5042. when ($_VISIBILITY_LEVEL != "" && $IGNORE_VISIBILITY != "yes") {
  5043. when ($CLANG == "yes" || $GCC == "yes") {
  5044. _CFLAGS_VISIBILITY=-fvisibility=${tolower:_VISIBILITY_LEVEL}
  5045. }
  5046. }
  5047. CFLAGS+=$_CFLAGS_VISIBILITY
  5048. # tag:cpp-specific
  5049. macro SDBUS_CPP_ADAPTOR(File) {
  5050. .CMD=${tool:"contrib/libs/sdbus-cpp/tools/xml2cpp-codegen"} --adaptor=${output;nopath;noext:File.adaptor.h} ${input:File}
  5051. .PEERDIR=contrib/libs/sdbus-cpp
  5052. }
  5053. # tag:cpp-specific
  5054. macro SDBUS_CPP_PROXY(File) {
  5055. .CMD=${tool:"contrib/libs/sdbus-cpp/tools/xml2cpp-codegen"} --proxy=${output;nopath;noext:File.proxy.h} ${input:File}
  5056. .PEERDIR=contrib/libs/sdbus-cpp
  5057. }
  5058. # tag:python-specific
  5059. macro _PY_ENUM_SERIALIZATION_TO_JSON(File) {
  5060. .CMD=$ENUM_PARSER_TOOL ${input:File} --output ${output;noext;suf=.generated.h:File} --json-output ${output;noext:File.json} ${hide;kv:"p EN"} ${hide;kv:"pc yellow"}
  5061. }
  5062. # tag:python-specific
  5063. macro _PY_ENUM_SERIALIZATION_TO_PY(File) {
  5064. .CMD=${tool:"metrika/core/tools/python_enum_generator"} ${input;noext:File.json} -D ${MODDIR} --output ${output;noext:File.py} ${hide;kv:"p EN"} ${hide;kv:"pc yellow"}
  5065. }
  5066. macro NGINX_MODULES(Modules...) {
  5067. PEERDIR(${Modules})
  5068. RUN_PROGRAM(nginx/module_gen ${Modules} CWD ${ARCADIA_ROOT} IN ${suf=/modules.json:Modules} OUTPUT_INCLUDES contrib/nginx/core/src/core/ngx_config.h contrib/nginx/core/src/core/ngx_core.h STDOUT ngx_modules.c)
  5069. }
  5070. ### @usage: ORIGINAL_SOURCE(Source)
  5071. ###
  5072. ### This macro specifies the source repository for contrib
  5073. ### Does nothing now (just a placeholder for future functionality)
  5074. ### See https://st.yandex-team.ru/DTCC-316
  5075. macro ORIGINAL_SOURCE(Source) {
  5076. ENABLE(UNUSED_MACRO)
  5077. }
  5078. # tag:licence
  5079. CREDITS_FILE_EXTRA_EXT=
  5080. CREDITS_FLAGS=
  5081. CREDITS_TEXTS_FILE=
  5082. NO_CREDITS_TEXTS_FILE=
  5083. WITH_CREDITS=
  5084. ### @usage: LICENSE_TEXTS(File)
  5085. ###
  5086. ### This macro specifies the filename with all library licenses texts
  5087. macro LICENSE_TEXTS(Source) {
  5088. SET(CREDITS_TEXTS_FILE $Source)
  5089. }
  5090. # tag:licence
  5091. ### @usage: WITHOUT_LICENSE_TEXTS()
  5092. ###
  5093. ### This macro indicates that the module has no license text
  5094. macro WITHOUT_LICENSE_TEXTS() {
  5095. ENABLE(NO_CREDITS_TEXTS_FILE)
  5096. }
  5097. # tag:licence
  5098. when ($WITH_CREDITS) {
  5099. CREDITS_FLAGS+=--credits-output ${output;pre=${MODULE_PREFIX};suf=${MODULE_SUFFIX}${CREDITS_FILE_EXTRA_EXT}.CREDITS.txt:REALPRJNAME}
  5100. }
  5101. GENERATE_MF=
  5102. when ($WITH_CREDITS) {
  5103. GENERATE_MF=$GENERATE_MF_CMD
  5104. }
  5105. # tag:internal
  5106. ### Add passed ya.conf.json and all bottle's formula external files to resources
  5107. ### File MUST be arcadia root relative path (without "${ARCADIA_ROOT}/" prefix).
  5108. ### NOTE:
  5109. ### An external formula file referenced from ya.conf.json must be passed as an arcadia root relative path and
  5110. ### should be located in any subdirectory of the ya.conf.json location ("build/" if we consider a production).
  5111. ### The later restriction prevents problems in selectively checkouted arcadia.
  5112. macro YA_CONF_JSON(File) {
  5113. _YA_CONF_JSON($File)
  5114. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS ${ARCADIA_ROOT}/$File)
  5115. }
  5116. # tag:internal
  5117. ### @usage: _STYLE_CPP([CONFIG])
  5118. ###
  5119. ### Proxy. Don't use. Call _ADD_CPP_LINTER_CHECK directly if you need a new macro, see STYLE_CPP
  5120. macro _STYLE_CPP(CONFIG...) {
  5121. _ADD_CPP_LINTER_CHECK(NAME clang_format LINTER tools/cpp_style_checker/cpp_style_checker GLOBAL_RESOURCES build/platform/clang/clang-format CONFIGS $CPP_LINTERS_DEFAULT_CONFIGS CUSTOM_CONFIG $CONFIG)
  5122. }
  5123. # tag:internal
  5124. ### @usage: _ADD_CPP_LINTER_CHECK(NAME name LINTER linter [DEPENDS deps] CONFIGS configs_file [GLOBAL_RESOURCES gr] [FILE_PROCESSING_TIME fpt] [EXTRA_PARAMS params] [CUSTOM_CONFIG cc] [CONFIG_TYPE ct])
  5125. ###
  5126. ### Triggers respective plugin
  5127. macro _ADD_CPP_LINTER_CHECK(Args...) {
  5128. SET(USE_ALL_SRCS yes)
  5129. HEADERS(.)
  5130. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS ${ARCADIA_ROOT}/${CPP_LINTERS_DEFAULT_CONFIGS})
  5131. }
  5132. # tag:test
  5133. ### @usage: STYLE_CPP([CONFIG_TYPE config_type])
  5134. ###
  5135. ### Run 'ya tool clang-format' test on all cpp sources and headers of the current module
  5136. macro STYLE_CPP(CONFIG_TYPE="") {
  5137. .ALLOWED_IN_LINTERS_MAKE=yes
  5138. _ADD_CPP_LINTER_CHECK(NAME clang_format LINTER tools/cpp_style_checker/cpp_style_checker GLOBAL_RESOURCES build/platform/clang/clang-format CONFIGS $CPP_LINTERS_DEFAULT_CONFIGS CONFIG_TYPE $CONFIG_TYPE)
  5139. }
  5140. ### @usage: HEADERS(<Dirs...> [EXCLUDE patterns...])
  5141. ###
  5142. ### Add all C/C++ header files (h|H|hh|hpp|hxx|ipp) in given directories to SRCS
  5143. ### Exclude files matching EXCLUDE patterns
  5144. macro HEADERS(EXCLUDE[], Dirs...) {
  5145. SET(_VAR_HEADERS_SALT __Dirs__ ${Dirs} __EXCLUDE__ ${EXCLUDE})
  5146. SET(_HEADERS_GLOB uniq_headers_${hash:_VAR_HEADERS_SALT})
  5147. _GLOB(${_HEADERS_GLOB} ${suf=/*.(h|H|hh|hpp|hxx|ipp):Dirs} EXCLUDE ${EXCLUDE})
  5148. SRCS(${${_HEADERS_GLOB}})
  5149. }
  5150. ### @usage: CLANG_EMIT_AST_CXX_RUN_TOOL(Tool Args... [SOURCES ...] [OPTS ...] [IN ...] [IN_NOPARSE ...] [TOOL ...] [OUTPUT_INCLUDES ...] [INDUCED_DEPS ...] [IN_DEPS ...] [STDOUT out-file-name] [STDOUT_NOAUTO out-file-name] [CWD cwd])
  5151. ###
  5152. ### Emit Clang ASTs from .cpp files listed in SOURCES parameter (CXXFLAGS and LLVM_OPTS are passed in, while CFLAGS and C_FLAGS_PLATFORM are not) and run tool Tool with Args... .
  5153. ### OPTS[] parameter is used to pass additional flags to clang. Parameters other than OPTS[] and SOURCES[] are used for runnig a generator (Tool):
  5154. ### - Tool - path to the directory of the tool
  5155. ### - Args... - Tool's arguments
  5156. ### - IN[] - input files required for running the Tool
  5157. ### - IN_NOPARSE[] - input files required for running the Tool, but these files are not parsed for dependencies
  5158. ### - TOOL[] - list of directories of axiliary tools used by Tool
  5159. ### - OUTPUT_INCLUDES[] - includes of the output files which are needed to "build" them
  5160. ### - STDOUT - redirect stdout of the Tool to the output file
  5161. ### - STDOUT_NOAUTO - redirect stdout of the Tool to the output file, but do not chain this file automatically to the processing queue
  5162. ### - CWD - path to the working directory of the Tool
  5163. ### Note: Generated AST files generated into BINDIR according to corresponding .cpp file names listed in SOURCES parameter.
  5164. macro CLANG_EMIT_AST_CXX_RUN_TOOL(SOURCES[], OPTS[], Tool, IN{input}[], IN_NOPARSE{input}[], OUT{output}[], OUT_NOAUTO{output}[], TOOL{tool}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], IN_DEPS[], STDOUT="", STDOUT_NOAUTO="", CWD="", ENV[], Args...) {
  5165. .CMD=${cwd:BINDIR} $YMAKE_PYTHON ${input:"build/scripts/clang_wrapper.py"} $WINDOWS ${CLANG_RESOURCE_GLOBAL}/bin/clang++ ${pre=-I:_C__INCLUDE} $CXXFLAGS $C_FLAGS_PLATFORM $LLVM_OPTS -emit-ast -c ${input:SOURCES} ${hide;tmp;noext;nopath:SOURCES.ast} $OPTS ${hide;kv:"p ST"} ${hide;kv:"pc light-green"} && ${cwd:CWD} ${env:ENV} ${tool:Tool} $Args ${hide;input:IN} ${hide;context=TEXT;input:IN_NOPARSE} ${hide;input:IN_DEPS} ${hide;output_include:OUTPUT_INCLUDES} $INDUCED_DEPS ${hide;tool:TOOL} ${hide;output:OUT} ${hide;noauto;output:OUT_NOAUTO} ${stdout;output:STDOUT} ${stdout;noauto;output:STDOUT_NOAUTO} ${hide;kv:"p PR"} ${hide;kv:"pc yellow"} ${hide;kv:"show_out"}
  5166. PEERDIR(build/platform/clang)
  5167. }
  5168. ### Hooks for contrib modules which can be transparenctly extended in repo internal python plugins
  5169. macro _CONTRIB_MODULE_HOOKS() {
  5170. ENABLE(UNUSED_MACRO)
  5171. }
  5172. ### Specify that current module is used as toolchain. Allows to have contrib hooks for toolchain modules
  5173. ### defined in repo internal python plugins
  5174. macro TOOLCHAIN(Name) {
  5175. ENABLE(UNUSED_MACRO)
  5176. }
  5177. macro WITHOUT_VERSION() {
  5178. ENABLE(SKIP_VERSION_REQUIREMENTS)
  5179. }
  5180. ### @usage: LINK_EXCLUDE_LIBRARIES(Libs...)
  5181. ###
  5182. ### Exclude specified external dynamic libraries from linker command
  5183. ###
  5184. ### May be used to implement shims/mocks, e.g. a lazy loader
  5185. ###
  5186. ### @example:
  5187. ###
  5188. ### LIBRARY()
  5189. ###
  5190. ### SRCS(
  5191. ### # provide some shim/mock implementation for libcuda.so
  5192. ### )
  5193. ###
  5194. ### LINK_EXCLUDE_LIBRARIES(cuda)
  5195. ###
  5196. ### END()
  5197. ###
  5198. macro LINK_EXCLUDE_LIBRARIES(Libs...) {
  5199. SET_APPEND(_LINK_EXCLUDE_LIBRARIES_GLOBAL $Libs)
  5200. }
  5201. ### @usage: GENERATE_IMPLIB(Lib, Path, [SONAME Name])
  5202. ###
  5203. ### Generates a wrapper for external dynamic library using Implib.so and excludes the real library from linker command
  5204. ###
  5205. ### The wrapper loads the real library on the first call to any of its functions
  5206. ###
  5207. ### @example:
  5208. ###
  5209. ### PEERDIR(build/platform/cuda)
  5210. ###
  5211. ### GENERATE_IMPLIB(cuda $CUDA_TARGET_ROOT/lib64/stubs/libcuda.so SONAME libcuda.so.1)
  5212. ###
  5213. macro GENERATE_IMPLIB(Lib, Path, SONAME="") {
  5214. .CMD=${tool:"contrib/tools/implib"} --target $HARDWARE_TYPE --outdir $BINDIR ${pre=--library-load-name :SONAME} $Path ${hide;output;nopath;suf=.init.c:Path} ${hide;output;nopath;suf=.tramp.S:Path}
  5215. LINK_EXCLUDE_LIBRARIES($Lib)
  5216. }