Makefile 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294
  1. -include ../../../../Rules.make
  2. export PATH=/bin:/sbin:/usr/bin:$(SDK_PATH_TARGET)/usr/bin:$PATH
  3. ModularizationPath = ../../../Modularization
  4. RootPath = ../Images/root
  5. OutputPath = ../output
  6. DEFINE = -D $(Project)
  7. CFLAGS = -O0 -g3 -Wall -fmessage-length=0
  8. TFLAGS = -lrt -lm -lpthread
  9. TOP = .
  10. INC_FLAGS += -I $(TOP)/Define
  11. INC_FLAGS += -I $(TOP)/Log
  12. INC_FLAGS += -I $(TOP)/ShareMemory
  13. INC_FLAGS += -I $(TOP)/CSU
  14. INC_FLAGS += -I $(TOP)/DataBase
  15. INC_FLAGS += -I $(TOP)/ModuleInternalComm
  16. INC_FLAGS += -I $(TOP)/ModuleEvComm
  17. INC_FLAGS += -I $(TOP)/ModuleUpdateFW
  18. INC_FLAGS += -I $(TOP)/ModuleChkSysTask
  19. INC_FLAGS += -I $(TOP)/ModulePrimary
  20. INC_FLAGS += -I $(TOP)/ModuleLcmCtrl
  21. INC_FLAGS += -I $(TOP)/ModuleDoComm
  22. INC_FLAGS += -I $(TOP)/ModuleEventLog
  23. DefineLib = $(TOP)/Define
  24. LogLib = $(TOP)/Log
  25. ShmMemLib = $(TOP)/ShareMemory
  26. CSULib = $(TOP)/CSU
  27. DataBaseLib = $(TOP)/DataBase
  28. InternalCommLib = $(TOP)/ModuleInternalComm
  29. EvCommLib = $(TOP)/ModuleEvComm
  30. UpdateFWLib = $(TOP)/ModuleUpdateFW
  31. ChkSysTaskLib = $(TOP)/ModuleChkSysTask
  32. PrimaryLib = $(TOP)/ModulePrimary
  33. LcmLib = $(TOP)/ModuleLcmCtrl
  34. DoCommLib = $(TOP)/ModuleDoComm
  35. EventLogLib = $(TOP)/ModuleEventLog
  36. SelectGunLib = $(TOP)/SelectGun
  37. ScriptLib = $(TOP)/Script
  38. #define library variable
  39. Internal485ProtocolLib = -L $(ModularizationPath)/Internal485Protocol -lInternal485Protocol
  40. #PsuCommProtocolLib = -L $(ModularizationPath)/PsuCommProtocol -lPsuCommProtocol
  41. #define library variable
  42. Lib_Module_RFID = "-L$(ModularizationPath)" -lModule_RFID
  43. RFID_H = -include$(ModularizationPath)/Module_RFID.h
  44. Lib_Module_Upgrade = "-L$(ModularizationPath)" -lModule_Upgrade
  45. ModuleUpgrade_H = -include$(ModularizationPath)/Module_Upgrade.h
  46. Lib_SQLite3 = "-L$(ModularizationPath)/ocppfiles" -lsqlite3
  47. SQLite3_H = -include$(ModularizationPath)/ocppfiles/sqlite3.h
  48. Lib_Module_RatedCurrent = "-L$(ModularizationPath)" -lModule_RatedCurrent
  49. RatedCurrent_H = -include$(ModularizationPath)/Module_RatedCurrent.h
  50. InfypwrPsuComm_H = -include$(ModularizationPath)/Infypwr_PsuCommObj.h
  51. InfypwrPsuComm_A = $(ModularizationPath)/libInfypwr_PsuCommObj.a
  52. #common lib
  53. COMMON_OBJ_FILES = common.o \
  54. $(DefineLib)/define.o \
  55. $(ShmMemLib)/shmMem.o \
  56. $(LogLib)/log.o \
  57. $(SelectGunLib)/SelectGun.o \
  58. MAIN_OBJ_FILES = $(COMMON_OBJ_FILES) $(DataBaseLib)/DataBase.o \
  59. $(CSULib)/main.o $(CSULib)/Primary.o $(CSULib)/WatchDog.o $(CSULib)/ZipFile.o \
  60. $(CSULib)/RFID.o $(CSULib)/SelfTest.o \
  61. $(CSULib)/Ethernet.o
  62. MAIN_SRC_FILES = $(patsubst %.o, %.c, $(MAIN_OBJ_FILES))
  63. %.o: %.c
  64. $(CC) $(CFLAGS) -c $<
  65. #DoComm
  66. DOCOMM_OBJ_FILES = $(COMMON_OBJ_FILES) $(DoCommLib)/DoComm.o
  67. DOCOMM_SRC_FILES = $(patsubst %.o, %.c, $(DOCOMM_OBJ_FILES))
  68. #internal comm lib
  69. INTERNALCOMM_OBJ_FILES = $(COMMON_OBJ_FILES) $(InternalCommLib)/internalComm.o \
  70. $(InternalCommLib)/Module_InternalComm.o $(InternalCommLib)/FanBoard.o \
  71. $(InternalCommLib)/LEDlight.o $(InternalCommLib)/RelayBoard.o \
  72. $(InternalCommLib)/AcPlug.o
  73. INTERNALCOMM_SRC_FILES = $(patsubst %.o, %.c, $(INTERNALCOMM_OBJ_FILES))
  74. %.o: %.c
  75. $(CC) $(CFLAGS) -c $<
  76. #EV comm lib
  77. EVCOMM_OBJ_FILES = $(COMMON_OBJ_FILES) $(RatedCurrent_H) $(EvCommLib)/Module_EvTxComm.o \
  78. $(EvCommLib)/Module_EvRxComm.o $(EvCommLib)/Ev_Comm.o $(EvCommLib)/AbnormalCCS.o \
  79. $(EvCommLib)/AbnormalCHA.o $(EvCommLib)/AbnormalGBT.o $(EvCommLib)/AbnormalState.o
  80. EVCOMM_SRC_FILES = $(patsubst %.o, %.c, $(EVCOMM_OBJ_FILES))
  81. %.o: %.c
  82. $(CC) $(CFLAGS) -c $<
  83. #Update FW
  84. UPDATEFW_OBJ_FILES = $(COMMON_OBJ_FILES) $(UpdateFWLib)/Module_UpdateFW.o
  85. UPDATEFW_SRC_FILES = $(patsubst %.o, %.c, $(UPDATEFW_OBJ_FILES))
  86. %.o: %.c
  87. $(CC) $(CFLAGS) -c $<
  88. #Check System Task
  89. CHKSYSTASK_OBJ_FILES = $(COMMON_OBJ_FILES) $(ChkSysTaskLib)/Module_ChkSysTask.o
  90. CHKSYSTASK_SRC_FILES = $(patsubst %.o, %.c, $(CHKSYSTASK_OBJ_FILES))
  91. %.o: %.c
  92. $(CC) $(CFLAGS) -c $<
  93. #Simulation
  94. SIMULATION_OBJ_FILES = $(COMMON_OBJ_FILES) simulation.o
  95. SIMULATION_SRC_FILES = $(patsubst %.o, %.c, $(SIMULATION_OBJ_FILES))
  96. %.o: %.c
  97. $(CC) $(CFLAGS) -c $<
  98. #Event Log
  99. EVENTLOG_OBJ_FILES = $(COMMON_OBJ_FILES) $(DataBaseLib)/DataBase.o \
  100. $(EventLogLib)/Module_EventLogging.o
  101. EVENTLOG_SRC_FILES = $(patsubst %.o, %.c, $(EVENTLOG_OBJ_FILES))
  102. %.o: %.c
  103. $(CC) $(CFLAGS) -c $<
  104. #LCM Control
  105. LCM_OBJ_FILES = $(COMMON_OBJ_FILES) $(LcmLib)/Module_LcmControl.o
  106. LCM_SRC_FILES = $(patsubst %.o, %.c, $(LCM_OBJ_FILES))
  107. #Primary
  108. PRIMARY_OBJ_FILES = $(COMMON_OBJ_FILES) $(PrimaryLib)/PrimaryComm.o \
  109. $(PrimaryLib)/Module_PrimaryComm.o
  110. PRIMARY_SRC_FILES = $(patsubst %.o, %.c, $(PRIMARY_OBJ_FILES))
  111. %.o: %.c
  112. $(CC) $(CFLAGS) -c $<
  113. #ReadCmdLine
  114. READCMDLINE_OBJ_FILES = $(COMMON_OBJ_FILES) ReadCmdline.o
  115. READCMDLINE_SRC_FILES = $(patsubst %.o, %.c, $(READCMDLINE_OBJ_FILES))
  116. %.o: %.c
  117. $(CC) $(CFLAGS) -c $<
  118. all: CopyFile apps
  119. apps: MainTask DoCommTask EvCommTask UpdateFWTask ChkSysTask \
  120. EventLoggingTask InternalCommTask LcmControlTask \
  121. PrimaryCommTask ReadCmdlineTask UnsafetyOutputTool \
  122. SimulationApp FactoryConfigApp OtherTools CleanExec
  123. MainTask:
  124. $(CC) $(DEFINE) $(MAIN_SRC_FILES) $(CFLAGS) $(TFLAGS) $(INC_FLAGS) $(SQLite3_H) $(ModuleUpgrade_H) $(RateCurrent_H) \
  125. $(RFID_H) $(Lib_Module_RFID) $(Lib_Module_Upgrade) $(Lib_SQLite3) $(Lib_Module_RateCurrent) \
  126. $(CheckSystemTask_H) -o main
  127. #$(CC) $(DEFINE) $(SQLite3_H) $(ModuleUpgrade_H) $(RFID_H) $(RatedCurrent_H) $(CFLAGS) -c -o main.o main.c
  128. #$(CC) $(DEFINE) $(SQLite3_H) $(ModuleUpgrade_H) $(RFID_H) $(RatedCurrent_H) $(CFLAGS) -c -o timeout.o timeout.c
  129. #$(CC) $(DEFINE) $(CFLAGS) -c -o common.o common.c
  130. #$(CC) $(TFLAGS) -o main main.o timeout.o common.o ${Lib_Module_RFID} ${Lib_Module_Upgrade} ${Lib_SQLite3} $(Lib_Module_RatedCurrent)
  131. DoCommTask:
  132. $(CC) $(DEFINE) $(DOCOMM_SRC_FILES) $(CFLAGS) $(TFLAGS) $(INC_FLAGS) -o Module_DoComm
  133. #$(CC) $(DEFINE) $(CFLAGS) -c -o define.o $(DefineLib)/define.c
  134. #$(CC) $(DEFINE) $(CFLAGS) -c -o DoComm.o $(DoCommLib)/DoComm.c
  135. #$(CC) -o Module_DoComm DoComm.o define.o
  136. EvCommTask:
  137. $(CC) $(DEFINE) $(EVCOMM_SRC_FILES) $(CFLAGS) $(TFLAGS) $(INC_FLAGS) $(Lib_Module_RatedCurrent) -o Module_EvComm
  138. #$(CC) $(DEFINE) $(CFLAGS) $(RatedCurrent_H) -c -o Ev_Comm.o $(EvCommLib)/Ev_Comm.c
  139. #$(CC) $(DEFINE) $(CFLAGS) $(RatedCurrent_H) -c -o Module_EvComm.o $(EvCommLib)/Module_EvComm.c
  140. #$(CC) -o Module_EvComm Ev_Comm.o Module_EvComm.o $(Lib_Module_RatedCurrent)
  141. UpdateFWTask:
  142. $(CC) $(DEFINE) $(UPDATEFW_SRC_FILES) $(CFLAGS) $(TFLAGS) $(INC_FLAGS) $(Lib_Module_Upgrade) $(ModuleUpgrade_H) -o Module_UpdateFW
  143. #$(CC) $(DEFINE) $(CFLAGS) -c -o Module_UpdateFW.o $(UpdateFWLib)/Module_UpdateFW.c
  144. #$(CC) -o Module_UpdateFW Module_UpdateFW.o
  145. ChkSysTask:
  146. $(CC) $(DEFINE) $(CHKSYSTASK_SRC_FILES) $(CFLAGS) $(TFLAGS) $(INC_FLAGS) -o Module_ChkSysTask
  147. #$(CC) $(DEFINE) $(CFLAGS) -c -o Module_ChkSysTask.o $(ChkSysTaskLib)/Module_ChkSysTask.c
  148. #$(CC) -o Module_ChkSysTask Module_ChkSysTask.o
  149. SimulationApp:
  150. $(CC) $(DEFINE) $(SIMULATION_SRC_FILES) $(CFLAGS) $(TFLAGS) $(INC_FLAGS) -o simulation
  151. #$(CC) $(DEFINE) $(CFLAGS) -c -o simulation.o simulation.c
  152. #$(CC) -o simulation simulation.o
  153. EventLoggingTask:
  154. $(CC) $(DEFINE) $(EVENTLOG_SRC_FILES) $(CFLAGS) $(TFLAGS) $(INC_FLAGS) $(SQLite3_H) $(Lib_SQLite3) -o Module_EventLogging
  155. #$(CC) $(DEFINE) $(CFLAGS) -c -o define.o $(DefineLib)/define.c
  156. #$(CC) $(DEFINE) $(SQLite3_H) $(CFLAGS) -c -o Module_EventLogging.o $(EventLogLib)/Module_EventLogging.c
  157. #$(CC) -o Module_EventLogging Module_EventLogging.o ${Lib_SQLite3} define.o
  158. InternalCommTask:
  159. $(CC) $(DEFINE) $(INTERNALCOMM_SRC_FILES) $(CFLAGS) $(TFLAGS) $(INC_FLAGS) -o Module_InternalComm
  160. #$(CC) $(DEFINE) $(CFLAGS) $(ModuleRelay_H) -c -o internalComm.o $(InternalCommLib)/internalComm.c
  161. #$(CC) $(DEFINE) $(CFLAGS) $(ModuleRelay_H) -c -o Module_InternalComm.o $(InternalCommLib)/Module_InternalComm.c
  162. #$(CC) $(TFLAGS) -o Module_InternalComm Module_InternalComm.o internalComm.o $(Lib_ModuleRelay)
  163. LcmControlTask:
  164. $(CC) $(DEFINE) $(LCM_SRC_FILES) $(CFLAGS) $(TFLAGS) $(INC_FLAGS) -o Module_LcmControl
  165. #$(CC) $(DEFINE) $(CFLAGS) -c -o define.o $(DefineLib)/define.c
  166. #$(CC) $(DEFINE) $(CFLAGS) -c -o Module_LcmControl.o $(LcmLib)/Module_LcmControl.c
  167. #$(CC) -o Module_LcmControl Module_LcmControl.o define.o
  168. PrimaryCommTask:
  169. $(CC) $(DEFINE) $(PRIMARY_SRC_FILES) $(CFLAGS) $(TFLAGS) $(INC_FLAGS) -o Module_PrimaryComm
  170. #$(CC) $(DEFINE) $(CFLAGS) -c -o PrimaryComm.o $(PrimaryLib)/PrimaryComm.c
  171. #$(CC) $(DEFINE) $(CFLAGS) -c -o Module_PrimaryComm.o $(PrimaryLib)/Module_PrimaryComm.c
  172. #$(CC) -o Module_PrimaryComm Module_PrimaryComm.o PrimaryComm.o
  173. PsuCommTask:
  174. $(CC) $(DEFINE) $(InfypwrPsuComm_H) $(CFLAGS) -c -o Module_PsuComm.o Module_PsuComm.c
  175. $(CC) -o Module_PsuComm Module_PsuComm.o $(InfypwrPsuComm_A)
  176. ReadCmdlineTask:
  177. $(CC) $(DEFINE) $(READCMDLINE_SRC_FILES) $(CFLAGS) $(TFLAGS) $(INC_FLAGS) -o ReadCmdline
  178. #$(CC) $(DEFINE) $(CFLAGS) -c -o ReadCmdline.o ReadCmdline.c
  179. #$(CC) -o ReadCmdline ReadCmdline.o
  180. UnsafetyOutputTool:
  181. $(CC) $(DEFINE) $(InfypwrPsuComm_H) $(CFLAGS) -c -o OutputTask.o OutputTask.c
  182. $(CC) -o UnsafetyOutputTask OutputTask.o $(InfypwrPsuComm_A)
  183. FactoryConfigApp:
  184. @echo "===== Module_FactoryConfig_Task =================================="
  185. rm -f FactoryConfig
  186. gcc $(DEFINE) -o FactoryConfig FactoryConfig.c
  187. mkdir -p /Storage/SystemLog
  188. ./FactoryConfig -f;true
  189. cp /mnt/FactoryDefaultConfig.bin ../Images
  190. rm -f FactoryConfig;
  191. $(CC) $(DEFINE) $(CFLAGS) -c -o FactoryConfig.o FactoryConfig.c
  192. $(CC) -o FactoryConfig FactoryConfig.o
  193. OtherTools:
  194. cp -f $(ScriptLib)/init.sh $(RootPath)
  195. cp -f $(ScriptLib)/kill.sh $(RootPath)
  196. cp -f $(ScriptLib)/web.sh $(RootPath)
  197. cp -f main $(RootPath)
  198. cp -f Module_DoComm $(RootPath)
  199. cp -f Module_EvComm $(RootPath)
  200. cp -f Module_UpdateFW $(RootPath)
  201. cp -f Module_ChkSysTask $(RootPath)
  202. cp -f simulation $(RootPath)
  203. cp -f Module_EventLogging $(RootPath)
  204. cp -f Module_InternalComm $(RootPath)
  205. cp -f Module_LcmControl $(RootPath)
  206. cp -f Module_PrimaryComm $(RootPath)
  207. #cp -f Module_PsuComm $(RootPath)
  208. cp -f ReadCmdline $(RootPath)
  209. cp -f UnsafetyOutputTask $(RootPath)
  210. cp -f FactoryConfig $(RootPath)
  211. if [ ! -d $(OutputPath) ]; then mkdir -p $(OutputPath); fi
  212. cp -f $(ScriptLib)/init.sh $(OutputPath)
  213. cp -f $(ScriptLib)/kill.sh $(OutputPath)
  214. cp -f $(ScriptLib)/web.sh $(OutputPath)
  215. cp -f $(ScriptLib)/SearchIP.sh $(OutputPath)
  216. cp -f main $(OutputPath)
  217. cp -f Module_DoComm $(OutputPath)
  218. cp -f Module_EvComm $(OutputPath)
  219. cp -f Module_UpdateFW $(OutputPath)
  220. cp -f Module_ChkSysTask $(OutputPath)
  221. cp -f simulation $(OutputPath)
  222. cp -f Module_EventLogging $(OutputPath)
  223. cp -f Module_InternalComm $(OutputPath)
  224. cp -f Module_LcmControl $(OutputPath)
  225. cp -f Module_PrimaryComm $(OutputPath)
  226. #cp -f Module_PsuComm $(OutputPath)
  227. cp -f ReadCmdline $(OutputPath)
  228. cp -f UnsafetyOutputTask $(OutputPath)
  229. cp -f FactoryConfig $(OutputPath)
  230. CopyFile:
  231. rm -rfv ../Images/root
  232. mkdir -p ../Images/root
  233. CleanExec:
  234. rm -f *.o
  235. rm main
  236. rm Module_EvComm
  237. rm Module_UpdateFW
  238. rm Module_ChkSysTask
  239. rm simulation
  240. rm Module_EventLogging
  241. rm Module_InternalComm
  242. rm Module_LcmControl
  243. rm Module_PrimaryComm
  244. #rm Module_PsuComm
  245. rm ReadCmdline
  246. rm FactoryConfig
  247. rm Module_DoComm