Home | History | Annotate | Download | only in tpm2
      1 
      2 # Copyright 2015 The Chromium OS Authors. All rights reserved.
      3 # Use of this source code is governed by a BSD-style license that can be
      4 # found in the LICENSE file.
      5 
      6 obj ?= ./build
      7 CROSS_COMPILE ?=
      8 CC ?= $(CROSS_COMPILE)gcc
      9 AR ?= $(CROSS_COMPILE)ar
     10 
     11 HOST_SOURCES =
     12 SOURCES  = ActivateCredential.c
     13 SOURCES += AlgorithmCap.c
     14 SOURCES += Attest_spt.c
     15 SOURCES += Bits.c
     16 SOURCES += Cancel.c
     17 SOURCES += Certify.c
     18 SOURCES += CertifyCreation.c
     19 SOURCES += ChangeEPS.c
     20 SOURCES += ChangePPS.c
     21 SOURCES += Clear.c
     22 SOURCES += ClearControl.c
     23 SOURCES += Clock.c
     24 SOURCES += ClockRateAdjust.c
     25 SOURCES += ClockSet.c
     26 SOURCES += CommandAudit.c
     27 SOURCES += CommandCodeAttributes.c
     28 SOURCES += CommandDispatcher.c
     29 SOURCES += Commit.c
     30 SOURCES += ContextLoad.c
     31 SOURCES += ContextSave.c
     32 SOURCES += Context_spt.c
     33 HOST_SOURCES += CpriCryptPri.c
     34 HOST_SOURCES += CpriECC.c
     35 HOST_SOURCES += CpriHash.c
     36 HOST_SOURCES += CpriMisc.c
     37 HOST_SOURCES += CpriRNG.c
     38 HOST_SOURCES += CpriRSA.c
     39 HOST_SOURCES += CpriSym.c
     40 SOURCES += Create.c
     41 SOURCES += CreatePrimary.c
     42 SOURCES += CryptSelfTest.c
     43 SOURCES += CryptUtil.c
     44 SOURCES += DA.c
     45 SOURCES += DRTM.c
     46 SOURCES += DictionaryAttackLockReset.c
     47 SOURCES += DictionaryAttackParameters.c
     48 SOURCES += Duplicate.c
     49 SOURCES += ECC_Parameters.c
     50 SOURCES += ECDH_KeyGen.c
     51 SOURCES += ECDH_ZGen.c
     52 SOURCES += EC_Ephemeral.c
     53 SOURCES += EncryptDecrypt.c
     54 SOURCES += Entity.c
     55 HOST_SOURCES += Entropy.c
     56 SOURCES += EventSequenceComplete.c
     57 SOURCES += EvictControl.c
     58 SOURCES += ExecCommand.c
     59 SOURCES += FieldUpgradeData.c
     60 SOURCES += FieldUpgradeStart.c
     61 SOURCES += FirmwareRead.c
     62 SOURCES += FlushContext.c
     63 SOURCES += GetCapability.c
     64 SOURCES += GetCommandAuditDigest.c
     65 SOURCES += GetCommandCodeString.c
     66 SOURCES += GetRandom.c
     67 SOURCES += GetSessionAuditDigest.c
     68 SOURCES += GetTestResult.c
     69 SOURCES += GetTime.c
     70 SOURCES += Global.c
     71 SOURCES += HMAC.c
     72 SOURCES += HMAC_Start.c
     73 SOURCES += Handle.c
     74 SOURCES += HandleProcess.c
     75 SOURCES += Hash.c
     76 SOURCES += HashSequenceStart.c
     77 SOURCES += Hierarchy.c
     78 SOURCES += HierarchyChangeAuth.c
     79 SOURCES += HierarchyControl.c
     80 SOURCES += Import.c
     81 SOURCES += IncrementalSelfTest.c
     82 SOURCES += Load.c
     83 SOURCES += LoadExternal.c
     84 SOURCES += Locality.c
     85 SOURCES += LocalityPlat.c
     86 SOURCES += MakeCredential.c
     87 SOURCES += Marshal_ActivateCredential.c
     88 SOURCES += Marshal_Certify.c
     89 SOURCES += Marshal_CertifyCreation.c
     90 SOURCES += Marshal_ChangeEPS.c
     91 SOURCES += Marshal_ChangePPS.c
     92 SOURCES += Marshal_Clear.c
     93 SOURCES += Marshal_ClearControl.c
     94 SOURCES += Marshal_ClockRateAdjust.c
     95 SOURCES += Marshal_ClockSet.c
     96 SOURCES += Marshal_Commit.c
     97 SOURCES += Marshal_ContextLoad.c
     98 SOURCES += Marshal_ContextSave.c
     99 SOURCES += Marshal_Create.c
    100 SOURCES += Marshal_CreatePrimary.c
    101 SOURCES += Marshal_DictionaryAttackLockReset.c
    102 SOURCES += Marshal_DictionaryAttackParameters.c
    103 SOURCES += Marshal_Duplicate.c
    104 SOURCES += Marshal_ECC_Parameters.c
    105 SOURCES += Marshal_ECDH_KeyGen.c
    106 SOURCES += Marshal_ECDH_ZGen.c
    107 SOURCES += Marshal_EC_Ephemeral.c
    108 SOURCES += Marshal_EncryptDecrypt.c
    109 SOURCES += Marshal_EventSequenceComplete.c
    110 SOURCES += Marshal_EvictControl.c
    111 SOURCES += Marshal_FieldUpgradeData.c
    112 SOURCES += Marshal_FieldUpgradeStart.c
    113 SOURCES += Marshal_FirmwareRead.c
    114 SOURCES += Marshal_FlushContext.c
    115 SOURCES += Marshal_GetCapability.c
    116 SOURCES += Marshal_GetCommandAuditDigest.c
    117 SOURCES += Marshal_GetRandom.c
    118 SOURCES += Marshal_GetSessionAuditDigest.c
    119 SOURCES += Marshal_GetTestResult.c
    120 SOURCES += Marshal_GetTime.c
    121 SOURCES += Marshal_HMAC.c
    122 SOURCES += Marshal_HMAC_Start.c
    123 SOURCES += Marshal_Hash.c
    124 SOURCES += Marshal_HashSequenceStart.c
    125 SOURCES += Marshal_HierarchyChangeAuth.c
    126 SOURCES += Marshal_HierarchyControl.c
    127 SOURCES += Marshal_Import.c
    128 SOURCES += Marshal_IncrementalSelfTest.c
    129 SOURCES += Marshal_Load.c
    130 SOURCES += Marshal_LoadExternal.c
    131 SOURCES += Marshal_MakeCredential.c
    132 SOURCES += Marshal_NV_Certify.c
    133 SOURCES += Marshal_NV_ChangeAuth.c
    134 SOURCES += Marshal_NV_DefineSpace.c
    135 SOURCES += Marshal_NV_Extend.c
    136 SOURCES += Marshal_NV_GlobalWriteLock.c
    137 SOURCES += Marshal_NV_Increment.c
    138 SOURCES += Marshal_NV_Read.c
    139 SOURCES += Marshal_NV_ReadLock.c
    140 SOURCES += Marshal_NV_ReadPublic.c
    141 SOURCES += Marshal_NV_SetBits.c
    142 SOURCES += Marshal_NV_UndefineSpace.c
    143 SOURCES += Marshal_NV_UndefineSpaceSpecial.c
    144 SOURCES += Marshal_NV_Write.c
    145 SOURCES += Marshal_NV_WriteLock.c
    146 SOURCES += Marshal_ObjectChangeAuth.c
    147 SOURCES += Marshal_PCR_Allocate.c
    148 SOURCES += Marshal_PCR_Event.c
    149 SOURCES += Marshal_PCR_Extend.c
    150 SOURCES += Marshal_PCR_Read.c
    151 SOURCES += Marshal_PCR_Reset.c
    152 SOURCES += Marshal_PCR_SetAuthPolicy.c
    153 SOURCES += Marshal_PCR_SetAuthValue.c
    154 SOURCES += Marshal_PP_Commands.c
    155 SOURCES += Marshal_PolicyAuthValue.c
    156 SOURCES += Marshal_PolicyAuthorize.c
    157 SOURCES += Marshal_PolicyCommandCode.c
    158 SOURCES += Marshal_PolicyCounterTimer.c
    159 SOURCES += Marshal_PolicyCpHash.c
    160 SOURCES += Marshal_PolicyDuplicationSelect.c
    161 SOURCES += Marshal_PolicyGetDigest.c
    162 SOURCES += Marshal_PolicyLocality.c
    163 SOURCES += Marshal_PolicyNV.c
    164 SOURCES += Marshal_PolicyNameHash.c
    165 SOURCES += Marshal_PolicyNvWritten.c
    166 SOURCES += Marshal_PolicyOR.c
    167 SOURCES += Marshal_PolicyPCR.c
    168 SOURCES += Marshal_PolicyPassword.c
    169 SOURCES += Marshal_PolicyPhysicalPresence.c
    170 SOURCES += Marshal_PolicyRestart.c
    171 SOURCES += Marshal_PolicySecret.c
    172 SOURCES += Marshal_PolicySigned.c
    173 SOURCES += Marshal_PolicyTicket.c
    174 SOURCES += Marshal_Quote.c
    175 SOURCES += Marshal_RSA_Decrypt.c
    176 SOURCES += Marshal_RSA_Encrypt.c
    177 SOURCES += Marshal_ReadClock.c
    178 SOURCES += Marshal_ReadPublic.c
    179 SOURCES += Marshal_Rewrap.c
    180 SOURCES += Marshal_SelfTest.c
    181 SOURCES += Marshal_SequenceComplete.c
    182 SOURCES += Marshal_SequenceUpdate.c
    183 SOURCES += Marshal_SetAlgorithmSet.c
    184 SOURCES += Marshal_SetCommandCodeAuditStatus.c
    185 SOURCES += Marshal_SetPrimaryPolicy.c
    186 SOURCES += Marshal_Shutdown.c
    187 SOURCES += Marshal_Sign.c
    188 SOURCES += Marshal_StartAuthSession.c
    189 SOURCES += Marshal_Startup.c
    190 SOURCES += Marshal_StirRandom.c
    191 SOURCES += Marshal_TestParms.c
    192 SOURCES += Marshal_Unseal.c
    193 SOURCES += Marshal_VerifySignature.c
    194 SOURCES += Marshal_ZGen_2Phase.c
    195 SOURCES += Manufacture.c
    196 HOST_SOURCES += MathFunctions.c
    197 SOURCES += MemoryLib.c
    198 SOURCES += NV.c
    199 HOST_SOURCES += NVMem.c
    200 SOURCES += NV_Certify.c
    201 SOURCES += NV_ChangeAuth.c
    202 SOURCES += NV_DefineSpace.c
    203 SOURCES += NV_Extend.c
    204 SOURCES += NV_GlobalWriteLock.c
    205 SOURCES += NV_Increment.c
    206 SOURCES += NV_Read.c
    207 SOURCES += NV_ReadLock.c
    208 SOURCES += NV_ReadPublic.c
    209 SOURCES += NV_SetBits.c
    210 SOURCES += NV_UndefineSpace.c
    211 SOURCES += NV_UndefineSpaceSpecial.c
    212 SOURCES += NV_Write.c
    213 SOURCES += NV_WriteLock.c
    214 SOURCES += NV_spt.c
    215 SOURCES += Object.c
    216 SOURCES += ObjectChangeAuth.c
    217 SOURCES += Object_spt.c
    218 SOURCES += PCR.c
    219 SOURCES += PCR_Allocate.c
    220 SOURCES += PCR_Event.c
    221 SOURCES += PCR_Extend.c
    222 SOURCES += PCR_Read.c
    223 SOURCES += PCR_Reset.c
    224 SOURCES += PCR_SetAuthPolicy.c
    225 SOURCES += PCR_SetAuthValue.c
    226 SOURCES += PP.c
    227 SOURCES += PPPlat.c
    228 SOURCES += PP_Commands.c
    229 SOURCES += PlatformData.c
    230 SOURCES += PolicyAuthValue.c
    231 SOURCES += PolicyAuthorize.c
    232 SOURCES += PolicyCommandCode.c
    233 SOURCES += PolicyCounterTimer.c
    234 SOURCES += PolicyCpHash.c
    235 SOURCES += PolicyDuplicationSelect.c
    236 SOURCES += PolicyGetDigest.c
    237 SOURCES += PolicyLocality.c
    238 SOURCES += PolicyNV.c
    239 SOURCES += PolicyNameHash.c
    240 SOURCES += PolicyNvWritten.c
    241 SOURCES += PolicyOR.c
    242 SOURCES += PolicyPCR.c
    243 SOURCES += PolicyPassword.c
    244 SOURCES += PolicyPhysicalPresence.c
    245 SOURCES += PolicyRestart.c
    246 SOURCES += PolicySecret.c
    247 SOURCES += PolicySigned.c
    248 SOURCES += PolicyTicket.c
    249 SOURCES += Policy_spt.c
    250 SOURCES += Power.c
    251 SOURCES += PowerPlat.c
    252 SOURCES += PropertyCap.c
    253 SOURCES += Quote.c
    254 HOST_SOURCES += RSAData.c
    255 HOST_SOURCES += RSAKeySieve.c
    256 SOURCES += RSA_Decrypt.c
    257 SOURCES += RSA_Encrypt.c
    258 SOURCES += ReadClock.c
    259 SOURCES += ReadPublic.c
    260 SOURCES += Rewrap.c
    261 SOURCES += SelfTest.c
    262 SOURCES += SequenceComplete.c
    263 SOURCES += SequenceUpdate.c
    264 SOURCES += Session.c
    265 SOURCES += SessionProcess.c
    266 SOURCES += SetAlgorithmSet.c
    267 SOURCES += SetCommandCodeAuditStatus.c
    268 SOURCES += SetPrimaryPolicy.c
    269 SOURCES += Shutdown.c
    270 SOURCES += Sign.c
    271 SOURCES += StartAuthSession.c
    272 SOURCES += Startup.c
    273 SOURCES += StirRandom.c
    274 #SOURCES += TPMCmdp.c
    275 #SOURCES += TPMCmds.c
    276 #SOURCES += TcpServer.c
    277 SOURCES += TestParms.c
    278 SOURCES += Ticket.c
    279 SOURCES += Time.c
    280 SOURCES += TpmFail.c
    281 SOURCES += Unique.c
    282 SOURCES += Unseal.c
    283 SOURCES += VerifySignature.c
    284 SOURCES += ZGen_2Phase.c
    285 SOURCES += _TPM_Hash_Data.c
    286 SOURCES += _TPM_Hash_End.c
    287 SOURCES += _TPM_Hash_Start.c
    288 SOURCES += _TPM_Init.c
    289 SOURCES += tpm_generated.c
    290 
    291 # Use V=1 for verbose output
    292 ifeq ($(V),)
    293 Q := @
    294 else
    295 Q :=
    296 endif
    297 
    298 ifeq ($(EMBEDDED_MODE),)
    299 SOURCES += $(HOST_SOURCES)
    300 CFLAGS += -Wall -Werror -fPIC
    301 else
    302 SOURCES += stubs_ecc.c
    303 SOURCES += stubs_hash.c
    304 SOURCES += stubs_sym.c
    305 CFLAGS += -DEMBEDDED_MODE
    306 ifneq ($(ROOTDIR),)
    307 CFLAGS += -I$(ROOTDIR)
    308 endif
    309 endif
    310 
    311 OBJS = $(patsubst %.c,$(obj)/%.o,$(SOURCES))
    312 DEPS = $(patsubst %.c,$(obj)/%.d,$(SOURCES))
    313 
    314 # This is the default target
    315 $(obj)/libtpm2.a: $(OBJS)
    316 	@echo "  AR      $(notdir $@)"
    317 	$(Q)$(AR) scr $@ $^
    318 
    319 $(obj):
    320 	@echo "  MKDIR   $(obj)"
    321 	$(Q)mkdir -p $(obj)
    322 
    323 $(obj)/%.d $(obj)/%.o: %.c | $(obj)
    324 	@echo "  CC      $(notdir $<)"
    325 	$(Q)$(CC) $(CFLAGS) -c -MMD -MF $(basename $@).d -o $(basename $@).o $<
    326 
    327 .PHONY: clean
    328 clean:
    329 	@echo "  RM      $(obj)"
    330 	$(Q)rm -rf $(obj)
    331 
    332 ifneq ($(MAKECMDGOALS),clean)
    333 -include $(DEPS)
    334 endif
    335