현재 5517 과 DACS 에서 광범위하게 사용하고 있는 makefile 에 대한 분석이다.
bat 파일 분석
우선 일단, 가장 먼저 실행하는 setup.bat 와 st20.bat 를 분석해보겠다. 먼저 setup.bat 파일이다.
참고로 rem 으로 시작하는 것은 주석을 의미한다. 여기서는 //(슬래쉬) 표시로 주석을 달도록 한다.
@echo off // 실행시키면, 실행되는 출력을 끈다 rem Perform the following steps when modifying this file to setup the build rem environment: rem 1. Set the following variable to point to the top level of the 5517 tree. rem NOTE: Use forward slashes and do not include a trailing slash. set STi5517ROOT=C:/stm/5517ref // STi5517ROOT 라는 변수에 다음의 경로를 대입한다 rem 2. Set the following variable to point to the location of your own rem targets.cfg file. rem NOTE: Use forward slashes and do not include a trailing slash. rem NOTE: This is the location of the targets.cfg shipped with the release rem which has no targets defined. If you provide your own, remember rem to delete the targets.cfg from this location. set DVD_TARGET_PATH=C:/stm/5517ref/config/platform // DVD_TARGET_PATH 라는 변수에 다음의 경로를 대입한다 rem 3. Add the location of the 5517ref bin directory to the front of your rem path. rem NOTE: Use backward slashes and do not include a trailing slash. set PATH=C:\stm\5517ref\bin;%PATH% // PATH 에 다음의 경로를 추가한다 rem 4. Comment out this goto line. rem goto Error echo Using 5517ref root: %STi5517ROOT% set DVD_MAKE=%STi5517ROOT%/make // DVD_MAKE 에 make 디렉토리의 경로를 추가한다 rem -------------------------------------- rem -------------------------------------- set DVD_ROOT=%STi5517ROOT%/src // DVD_ROOT 에 경로를 추가한다 set DVD_EXPORTS=%STi5517ROOT%/lib // DVD_EXPORTS 에 라이브러리 경로를 추가한다 rem See the release notes for descripton of these build options set DVD_TRANSPORT=stpti // DVD_TRANSPORT 에 stpti 을 등록한다 set DVD_PLATFORM=mb382 // DVD_PLATFORM 에 mb382 를 등록한다 rem set DVD_PLATFORM=mb361 set DVD_SERVICE=DVB // DVD_SERVICE 에 DVB 를 등록한다 set TARGET=c2hw_jei // TARGET 에 c2hw_jei 를 등록한다, target.cfg 파일의 변수 중에 변수에 등록된 DCU 로 접속하게 된다 rem set TARGET=5517 set DVD_TV_OUTPUT=RATIO_4TO3 // DVD_TV_OUTPUT 을 4 대 3 비율로 한다 set UNIFIED_MEMORY=1 // UNIFIED_MEMORY 를 1 로 세팅한다 set DVD_IO=UART // DVD_IO 를 UART (시리얼 포트) 로 한다 goto Done :Error echo This setup.bat file must be edited to reflect the installation location echo in order to work. Please read the instructions in the setup.bat file. echo This script is being run as: echo %0% :Done
자세한 사항은 주석을 참고하기 바란다. 이번에는 st20.bat 을 보도록 한다.
@echo off // 출력 메세지를 끈다 echo Setting up ST20 Embedded Toolset R1.9.6 // Setting up ST20 Embedded Toolset R1.9.6 을 화면에 출력한다 SET PATH=C:\STM\ST20R1.9.6\bin;%PATH% // STR1.9.6 디렉토리를 PATH 로 등록한다 SET ST20ROOT=C:\STM\ST20R1.9.6 // ST20ROOT 에 다음의 경로를 추가한다
makefile 분석
이번에는 makefile 을 분석해보자! 우선 5517 의 Makefile 의 경로는 5517 소스안에 있다.
여기서 가장 중심이 되는 파일은 generic.mak 이다. 여기서 각각의 다른 파일들을 불러온다.
이름 | 역할 |
app_startup | 별 중요해 보이지 않음 |
environment.mak | 호스트의 OS 가 어떤 것인지에 대해 정의함 |
builddir.mak | 빌드때의 환경을 정의 |