Ib tus neeg ua haujlwm Red Hat tau nthuav tawm Lub Hom Phiaj los ua ke. Tso GNU Ua 4.2

Richard WM Jones, sau ntawv pov thawj, ua haujlwm ntawm Red Hat, tswvcuab tshiab kev siv hluav taws xob sib dhos Hom Phiaj, tsom rau kev tshem tawm qhov tsis txaus thiab teeb meem hauv kev siv hluav taws xob ua thaum tswj xyuas qhov yooj yim thiab nkag siab ntawm cov ntawv sau. Kev siv hluav taws xob tsim tau tsim nyob rau xyoo 1976 thiab muaj ntau lub tswv yim tsis txaus; Cov hom phiaj npaj los tshem tawm cov kev tsis txaus no yam tsis hloov lub tswv yim dav dav.
Cov hom phiaj qhov chaws faib los ntawm muaj ntawv tso cai raws li GPLv2+.

Teeb meem yuav daws tau:

  • Kev them nyiaj yug tsuas yog ib qho kev daws teeb meem kev vam khom nkaus xwb - "cov lus qhia sib dhos ua haujlwm yog tias lub hom phiaj cov ntaub ntawv ploj lawm lossis laus dua ib qho ntawm cov kev vam khom." Lub hom phiaj npaj los siv lwm yam kev tawm tsam, xws li kuaj xyuas qhov muaj URL, sib piv lub sijhawm hloov kho nrog cov ntaub ntawv, ntsuas cov pob tsim hauv kuj, kev sib piv ntawm cov checksums, khiav cov ntaub ntawv xeem nrog xaiv hla kev xeem.
  • Thaum ua cov phiaj xwm tsim, ua tsis cais cov ntaub ntawv thiab cov npe txoj cai, thiab vim li ntawd, tsis muaj kev kuaj xyuas tias thaum khiav txoj cai, cov ntaub ntawv uas nws thov kom tsim yuav raug tsim. Piv txwv li, yog tias koj muaj ib txoj cai hu ua "test" uas sau cov ntawv sau nrog cov ntawv xeem, cov ntaub ntawv hu ua "test" raug tsim, ces cov kev xeem yuav tsis raug hu, vim tias ua yuav txiav txim siab tias lub hom phiaj yog tsim thiab tsis xav tau. ib qho kev nqis tes ua (rau Kev ua haujlwm nyob ib puag ncig qhov teeb meem hauv kev tsim, koj tuaj yeem teev cov lus qhia ".PHONY: test"). Lub hom phiaj qhia meej meej cais cov ntaub ntawv thiab cov npe txoj cai.

    Ib tus neeg ua haujlwm Red Hat tau nthuav tawm Lub Hom Phiaj los ua ke. Tso GNU Ua 4.2

  • Teeb meem nrog muab tsuas yog ib qho parameter rau cov lus qhia sib dhos.

    Ib tus neeg ua haujlwm Red Hat tau nthuav tawm Lub Hom Phiaj los ua ke. Tso GNU Ua 4.2

    Cov hom phiaj tso cai rau koj siv tus naj npawb ntawm cov npe tsis raug. Piv txwv li, koj tuaj yeem cais cov cim ntawm cov ntaub ntawv debug los ntawm lub npe:

    Ib tus neeg ua haujlwm Red Hat tau nthuav tawm Lub Hom Phiaj los ua ke. Tso GNU Ua 4.2

  • Teeb meem cuam tshuam nrog lub plhaub txhais lus. Piv txwv li, qhov xav tau los tswj kev khiav tawm ntawm qhov chaw hauv cov ntaub ntawv thiab cov npe ntawm cov ntaub ntawv pov tseg, cov khoom siv pov tseg ntawm kev tsim cov neeg txhais lus cais cais thaum ua tiav txhua qhov kev hais kom ua, kev txhais ob npaug ntawm cov cim "$" (siv ob lub plhaub thiab ua), coj mus rau hauv tus account indentations.

    Cov teeb meem no raug daws hauv Cov Hom Phiaj los ntawm kev siv lub cim "%" es tsis yog "$" rau kev sib sau ua ke ("$" tsuas yog rau lub plhaub), siv lub parser LALR(1), uas xav kom koj nyob ib puag ncig txoj hauv kev thiab cov npe cov ntaub ntawv nrog cov lus qhia thiab qhia cov lej thaiv nrog curly braces. Tag nrho cov lus txib thaiv tau tsim nyob rau hauv ib qho piv txwv ntawm lub plhaub hais kom ua, thiab arbitrary code formatting raug tso cai nyob rau hauv lub block, tsis muaj kev siv rau qhov chaw tshwj xeeb.

    Yog:
    phiaj: foo.o bar.o
    ${CC} ${CFLAGS} $< -o $@

    Ua:
    "target": "foo.o", "bar.o" {
    %CC %CFLAGS %< -o %@
    }

Lwm cov yam ntxwv ntawm Lub Hom Phiaj:

  • Kev them nyiaj yug xaiv rau kev qhia cov npe thiab cov kev txwv:

    lub hom phiaj tag nrho = : "target"

    lub hom phiaj link =
    "target": "foo.o", "bar.o" {... }

    lub hom phiaj compile (npe) =
    "%name.o" : "%name.c", "dep.h" { %CC %CFLAGS -c $^ -o $@ }

  • Ob hom tso tawm: ua hom kom phim cov hom phiaj tsim nrog cov npe cov ntaub ntawv (piv txwv li, cov ntaub ntawv "foo.o" phim "%name.o"), thiab hom kev sib sau ncaj qha:

    lub hom phiaj tag nrho = : link

    lub hom phiaj link =
    "target" : "foo.o", compile ("bar") {... }

    lub hom phiaj compile (npe) =
    "%name.o" : "%name.c", "dep.h" { %CC %CFLAGS -c $^ -o $@ }

  • Kev sibtham kev sibtham yog txiav txim siab los ntawm cov cai tshwj xeeb uas tuaj yeem siv los txiav txim siab qhov xav tau los sib sau ua ke lub hom phiaj. Yog tias qhov txuas tau ua rau muaj cov ntaub ntawv, ces qhov no tau txiav txim siab los ntawm cov kos npe sib raug ("lub hom phiaj" rau txoj cai lub npe thiab * cov ntaub ntawv ("lub hom phiaj") rau kev tshuaj xyuas cov ntaub ntawv).

    "target": "foo.o", "bar.o" {... }

    *file("target"): *file("foo.o"), *file("bar.o") {... }

  • Tus tsim tawm tuaj yeem txhais cov yam ntxwv ntawm kev sib dhos ua ke. Tus chij "*file" yog txhais los ntawm lub neej ntawd (@{...} qhia tawm kev tawm tsam, thiab "tawm 99" qhia txog qhov xav tau kev tsim kho dua tshiab:

    tactic *file (filename) = @{
    test -f %filename || ua ex99
    rau f hauv %

    Tau qhov twg los: opennet.ru

Ntxiv ib saib