vim tips
1. 열편집
ctrl + v 후 
1) y 하면 복사. 
2) :w test.txt 로 하면 저장ㅎ됨
3) shift+i 후 문자열 입력 후 esc 누르고 다음칸 이동하면 앞에 같은 문자가 들어감

2. 문자열 교체
:%s,/abc/def/,abc,g 로 하면 특수문자를 편하게 처리 가능

3. 특수문자 교체
^M = <ctrl+v><ctrl+m>
:%s/^M//g
:%s/\r//g

4. 바이너리로 열기
1) vim -b filename
2) :set binary

5. 창분할 후 제어
ctrl + w 한 다음에 v 하면 좌우로 분할 됨
ctrl + w 한 다음에
> 누르면 오른 쪽 창이 오른쪽 줄어듬
10> 하면 10 만큼 줄어듬

6. tab 설정도 가능
:tabnew
:tabedit filename
:tabclose
다음 탭 : gt
이전 탭 : gT
ctrl + pageup, ctrl + pagedown 으로도 이동 가능

7. 파일 내용 비교하기
$ vim -d file1 file2

8. 디렉토리 탐색하기
:e . (현재 디렉토리 탐색)

9. 파일 인코딩 변환
:e ++enc=utf-8
:e ++enc=euc-kr

10. 들여쓰기 재정렬
1) gg (맨 앞으로 이동해서)
2) =G (들여쓰기 작업 함)
or
{ 위치 또는 근처에서 =a 하면 이쁘게 해줌

https://1004lucifer.blogspot.com/2015/04/linuxunix-vimvi.html?m=1

 

 

매크로 활용
1. qa 로 시작
2. (작업...) q 로 종료
3. @a 로 실행 (@@ 는 앞에꺼 실행)

외부 명령어와 연동
:!ls -al (디렉토리 내용 확인)
:'<,'>!grep word (선택 영역에서 특정 단어 필터링)

쉘과 연동
ctrl + z (이러면 vi 를 백그라운드로 보냄)
fg (이 명령어를 입력하면 다시 돌아옴)
고급방식 : screen, tmux 사용 (한쪽에는 vi, 다른 쪽은 쉘)

+y 로 클립보드에 복사
+gP 로 붙여넣기

 

visual mode
블럭 선택 후 c (선택 영역 변경) r{문자} (특정 문자로 교체)

텍스트 수정
cw : 특정 단어 수정. 현 포인터부터 문자열 끝까지
cc : 줄을 지움

약자 설정
:abbr abc apple banana carrot
~.vimrc 파일에 추가할 수 있음.
제거는 :unabbrev abc
약자 목록 확인은 :abbreviate

명령어 모드에서 자주 사용하는 것은 키맵(keymap) 을 설정
:nnoremap <F2> :wq<CR>

고급 탐색 명령어
1) f (find) : 현재 줄에서 특정 문자로 이동
- 같은 문자가 여러 번 나오면 ; (다음) , (이전) 로 연속 탐색 가능
2) t (to) : 특정 문자 직전으로 이동
3) % (매칭 괄호)

Doxygen을 효과적으로 사용하기 위한 전문가 가이드

서론

Doxygen은 소스 코드의 주석을 기반으로 API 문서를 자동 생성하는 도구로, 프로젝트의 유지보수성과 협업 효율성을 크게 향상시킵니다. 본 가이드에서는 Doxygen을 최대한 활용하기 위한 20가지 핵심 전략을 체계적으로 설명합니다.

1. 기본 설정 최적화

1.1 Doxyfile 구성 전략

  • INPUT 설정: 문서화 대상 소스 경로 명시적 지정
 
text
INPUT = ./src ./include
  • RECURSIVE 활성화: 하위 디렉터리 자동 탐색
 
text
RECURSIVE = YES
  • FILE_PATTERNS 확장: 비표준 파일 확장자 포함
 
text
FILE_PATTERNS = *.c *.h *.md *.dox

1.2 그래프 시각화 설정

  • Graphviz 연동: 클래스 다이어그램 생성
 
text
HAVE_DOT = YES DOT_PATH = /usr/bin/dot CLASS_DIAGRAMS = YES

2. 주석 작성 표준

2.1 문서화 기본 원칙

  • 삼중 슬래시(///) 대신 블록 주석(/** */) 사용
  • 모든 공개 API 요소 문서화
  • 구현 세부사항보다 인터페이스 설명에 집중

2.2 태그 활용 가이드라인

 
c
/** * @brief 간결한 기능 설명 (50자 이내) * @details 상세 구현 내용 및 사용 예시 * @param[in] param1 입력 파라미터 설명 * @param[out] param2 출력 파라미터 설명 * @return 반환값 의미 및 가능한 값 * @retval 0 성공 시 반환값 * @retval -1 오류 발생 시 * @note 특이사항 또는 주의점 * @warning 잠재적 위험 요소 * @see 관련 함수/클래스 참조 */

3. 문서 구조화 전략

3.1 모듈화 기법

  • 그룹핑을 통한 논리적 구성
 
c
/** * @defgroup network_module 네트워크 모듈 * @brief 네트워크 통신 관련 기능 집합 */

3.2 계층적 문서 구성

 
c
/** * @page arch_overview 아키텍처 개요 * @section design_principle 설계 원칙 * @subsection scalability 확장성 */

4. 고급 기능 활용

4.1 조건부 문서화

 
c
/** * @cond INTERNAL * 내부 전용 구현 세부사항 * @endcond */

4.2 코드 조각 삽입

 
c
/// @code{.cpp} /// std::vector<int> vec{1,2,3}; /// vec.push_back(4); /// @endcode

5. 시각적 요소 강화

5.1 UML 다이어그램 생성

  • 클래스 관계 시각화
 
text
UML_LOOK = YES COLLABORATION_DIAGRAM = YES

5.2 커스텀 CSS 적용

 
text
HTML_EXTRA_STYLESHEET = custom.css

6. 품질 관리 전략

6.1 문서 빌드 검증

  • 경고 메시지 제로 목표
 
bash
doxygen Doxyfile 2> warnings.log

6.2 버전 관리 통합

 
text
PROJECT_NUMBER = "1.4.2" ALIASES += "version=\anchor v1_4_2 버전 1.4.2"

7. 협업 최적화

7.1 문서 변경 이력 추적

 
c
/** * @author 홍길동 * @date 2024-03-15 * @history * - 2024-03-20: 성능 최적화 적용 */

7.2 크로스 레퍼런싱

 
c
/// @ref network_module 참조

8. 성능 최적화

8.1 캐싱 메커니즘

 
text
CACHE_SIZE = 10

8.2 병렬 처리 활성화

 
text
DOT_NUM_THREADS = 8

9. 확장 기능 통합

9.1 MathJax 수식 지원

 
text
USE_MATHJAX = YES

9.2 외부 도구 연동

 
text
EXTERNAL_SEARCH = YES SEARCHENGINE_URL = https://custom-search.com?q=

10. 유지보수 전략

10.1 문서화 정책 수립

  • 주석 작성 표준 가이드 문서 배포
  • 정기적 문서 리뷰 프로세스 구축

10.2 자동화 스크립트

 
bash
#!/bin/bash doxygen Doxyfile linkchecker html/index.html

결론

Doxygen을 효과적으로 활용하려면 프로젝트 초기 단계부터 문서화 전략을 수립해야 합니다. 주석 작성 표준의 일관된 적용과 지속적인 품질 관리가 핵심이며, 시각적 요소와 상호 참조 기능을 적극 활용하면 개발자 경험을 크게 향상시킬 수 있습니다. 문서화 작업을 단순한 의무가 아닌 코드 품질 관리의 핵심 도구로 인식하고 팀 차원의 체계적인 접근이 필요합니다.

Citations:

  1. https://ftp.rtems.org/pub/rtems/people/joel/sw_eng_hb/eng/coding-doxygen.html
  2. https://pages.cs.wisc.edu/~jignesh/cs564/notes/Doxygen.pdf
  3. https://www.jaycon.com/doxygen-the-importance-of-software-documentation/
  4. https://wiki.squid-cache.org/ProgrammingGuide/DoxygenDocumentation
  5. https://jointcenterforsatellitedataassimilation-jedi-docs.readthedocs-hosted.com/en/7.0.0/inside/developer_tools/doxygen.html
  6. https://luckygg.tistory.com/342
  7. https://www.doxygen.nl/manual/grouping.html
  8. https://www.doxygen.nl/manual/preprocessing.html
  9. https://www.doxygen.nl/manual/markdown.html
  10. https://stackoverflow.com/questions/51667/best-tips-for-documenting-code-using-doxygen
  11. https://www.reddit.com/r/C_Programming/comments/154qsfm/a_tip_for_using_doxygen_in_the_design_phase/
  12. https://mesos.apache.org/documentation/latest/doxygen-style-guide/
  13. https://tex.stackexchange.com/questions/548397/ignoring-doxygen-comments-in-listings
  14. https://velog.io/@audgus47/Doxygen-Graphviz-%EC%82%AC%EC%9A%A9%EB%B2%95
  15. https://micro-os-plus.github.io/develop/doxygen-style-guide/
  16. https://www.doxygen.nl/manual/faq.html
  17. https://www.doxygen.nl/manual/diagrams.html
  18. https://exhale.readthedocs.io/en/latest/mastering_doxygen.html
  19. https://openocd.org/doc/doxygen/html/styledoxygen.html
  20. https://mezzanine.blacktoppstudios.com/best_practices_doxygen.html
  21. https://www.doxygen.nl/manual/docblocks.html
  22. https://www.youtube.com/watch?v=K21Ua-xiUYg
  23. https://stackoverflow.com/questions/52120027/doxygen-how-to-include-a-markdown-page-to-document-a-group
  24. https://github.com/doxygen/doxygen/issues/8414
  25. https://blog.naver.com/ikid4127/222223205865
  26. https://itlearningcenter.tistory.com/entry/Doxygen-%EC%84%A4%EC%B9%98%ED%95%98%EA%B8%B0
  27. https://stackoverflow.com/questions/17363014/doxygen-how-to-write-log-output-to-file
  28. https://crisluengo.github.io/doxpp/grouping.html
  29. https://github.com/doxygen/doxygen/issues/9350
  30. https://doxygen.nl/manual/additional.html
  31. https://jointcenterforsatellitedataassimilation-jedi-docs.readthedocs-hosted.com/en/1.2.0/inside/developer_tools/doxygen.html
  32. https://superuser.com/questions/685817/doxygen-specify-a-markdown-file-as-the-main-page
  33. https://stackoverflow.com/questions/77451053/how-to-use-ci-and-doxygen-to-know-only-if-new-code-is-well-documented
  34. https://github.com/Velron/doxygen-bootstrapped

Perplexity로부터의 답변: pplx.ai/share

C언어 영어 주석 작성 가이드

1. 기본 주석 작성 팁

주석의 목적

  • 명확성 (Clarity): 코드가 무엇을 하는지 설명
  • 의도 설명 (Intent Explanation): 왜 이런 방식으로 구현했는지 설명
  • 복잡한 로직 설명: 어려운 알고리즘이나 수식 설명

좋은 주석의 특징

  • 간결하고 명확함 (Concise and clear)
  • 코드를 반복하지 않음 (Don't repeat the code)
  • 미래의 개발자(자신 포함)를 위한 설명

2. 핵심 단어와 표현

기본 동사 (Basic Verbs)

- Initialize: 초기화하다
- Calculate/Compute: 계산하다
- Check/Validate: 확인하다/검증하다
- Allocate: 할당하다
- Free/Release: 해제하다
- Return: 반환하다
- Print/Display: 출력하다/표시하다
- Read/Input: 읽다/입력받다
- Process: 처리하다
- Update: 업데이트하다
- Compare: 비교하다
- Search/Find: 찾다
- Sort: 정렬하다
- Copy: 복사하다
- Convert: 변환하다

자주 사용하는 형용사

- Valid/Invalid: 유효한/무효한
- Empty/Full: 비어있는/가득한
- Maximum/Minimum: 최대/최소
- Current: 현재의
- Next/Previous: 다음/이전
- First/Last: 첫 번째/마지막
- Temporary: 임시의
- Final: 최종의

프로그래밍 관련 명사

- Variable: 변수
- Function: 함수
- Parameter/Argument: 매개변수/인수
- Array: 배열
- Pointer: 포인터
- Structure: 구조체
- Loop: 반복문
- Condition: 조건
- Index: 인덱스
- Counter: 카운터
- Buffer: 버퍼
- Memory: 메모리
- Error: 에러
- Result: 결과

3. 주석 패턴과 예문

3.1 함수 주석 패턴

/*
 * Function: function_name
 * Purpose: Brief description of what the function does
 * Parameters: 
 *   - param1: description
 *   - param2: description
 * Returns: description of return value
 */

// 예시
/*
 * Function: calculate_average
 * Purpose: Calculates the average of an array of integers
 * Parameters:
 *   - numbers: array of integers
 *   - size: number of elements in the array
 * Returns: average value as a double
 */
double calculate_average(int numbers[], int size)

3.2 변수 선언 주석

int count = 0;           // Counter for loop iterations
char *buffer;            // Temporary storage for user input
bool is_valid = false;   // Flag to check if input is valid
float temperature;       // Current temperature in Celsius

3.3 코드 블록 주석

// Initialize all variables to default values
count = 0;
sum = 0;
average = 0.0;

/* 
 * Main processing loop
 * Continue until user enters 'q' to quit
 */
while (input != 'q') {
    // Process user input here
}

// Error handling section
if (result == NULL) {
    printf("Error: Memory allocation failed\n");
    return -1;
}

4. 상황별 주석 문장 템플릿

4.1 초기화 관련

- Initialize variables to zero
- Set default values for all parameters  
- Clear the buffer before use
- Reset counter to starting position

4.2 조건문 관련

- Check if the input is valid
- Verify that the pointer is not NULL
- Test whether the array is empty
- Ensure the index is within bounds

4.3 반복문 관련

- Loop through all elements in the array
- Continue until end of file is reached
- Iterate over each character in the string
- Process each item in the list

4.4 메모리 관리 관련

- Allocate memory for the new structure
- Free previously allocated memory
- Check for memory allocation failure
- Release resources before exit

4.5 에러 처리 관련

- Handle invalid input gracefully
- Return error code if operation fails
- Display error message to user
- Exit program if critical error occurs

5. 실제 코드 예시

#include <stdio.h>
#include <stdlib.h>

/*
 * Program: Simple Calculator
 * Purpose: Performs basic arithmetic operations
 * Author: Your Name
 * Date: Current Date
 */

/*
 * Function: add_numbers
 * Purpose: Adds two integers and returns the result
 * Parameters:
 *   - a: first integer
 *   - b: second integer
 * Returns: sum of a and b
 */
int add_numbers(int a, int b) {
    return a + b;  // Simple addition operation
}

int main() {
    int num1, num2;      // User input numbers
    int result;          // Store calculation result
    char operation;      // Store selected operation
    
    // Display welcome message
    printf("Welcome to Simple Calculator\n");
    
    // Get user input
    printf("Enter first number: ");
    scanf("%d", &num1);
    
    printf("Enter second number: ");
    scanf("%d", &num2);
    
    // Perform calculation based on user choice
    printf("Enter operation (+, -, *, /): ");
    scanf(" %c", &operation);
    
    // Process the selected operation
    switch(operation) {
        case '+':
            result = add_numbers(num1, num2);
            printf("Result: %d + %d = %d\n", num1, num2, result);
            break;
            
        case '-':
            result = num1 - num2;  // Subtract second from first
            printf("Result: %d - %d = %d\n", num1, num2, result);
            break;
            
        default:
            printf("Error: Invalid operation\n");
            return -1;  // Exit with error code
    }
    
    return 0;  // Successful program termination
}

6. 주석 작성 시 주의사항

DO (권장사항)

  • 복잡한 로직에 대한 설명 제공
  • 함수의 목적과 매개변수 설명
  • 에러 처리 방법 설명
  • 알고리즘의 핵심 아이디어 설명

DON'T (피해야 할 것)

  • 명백한 코드 반복 금지
    // BAD: i++; // increment i by 1// GOOD: i++; // Move to next array element
    
  • 너무 길거나 복잡한 설명 피하기
  • 오래된 주석 방치하지 않기

7. 자주 사용하는 주석 템플릿

// TODO: Add error checking for this function
// FIXME: Memory leak possible here
// NOTE: This algorithm assumes sorted input
// WARNING: Do not modify this value directly
// HACK: Temporary solution, needs refactoring

이 가이드를 참고하여 체계적으로 영어 주석 작성 실력을 향상시켜보세요!

ps -ef

ps -ef | grep firefox

kill -9 12345

pkill -f firefox

 

https://luckygg.tistory.com/346

 

[Doxygen] 자주 사용하는 소스 코드 주석 및 페이지 문법 사용 방법(예제 포함)

Doxygen 사용을 위한 본문은 아래 링크를 참고하세요. [Doxygen] 독시젠으로 코드 문서 만들기 총정리 (예제 포함) [Doxygen] 독시젠으로 코드 문서 만들기 총정리 (예제 포함) 독시젠(Doxygen)이란? 혹시

luckygg.tistory.com

 

https://www.perplexity.ai/search/rinugseue-issneun-soseu-paileu-6kTMapVSSaWhzheAo0UagQ

 

리눅스에 있는 소스 파일을 doxygen 을 이용해서 정리하고 싶어. 기초부터 학습자료로 사용할 수

Doxygen은 소스코드 내의 주석을 자동으로 분석하여 전문적인 API 문서를 생성하는 강력한 도구입니다. 이 가이드는 Linux 환경에서 Doxygen을 설치하고 활용하여 소스코드를 체계적으로 문서화하는

www.perplexity.ai

 

 

Doxygen은 소스 코드에서 자동으로 문서를 생성해주는 강력한 도구입니다. C/C++를 비롯해 다양한 언어를 지원하며, HTML, PDF, LaTeX 등 여러 형태의 문서를 생성할 수 있습니다.

Doxygen 설치

Ubuntu/Debian

sudo apt update
sudo apt install doxygen doxygen-gui graphviz

CentOS/RHEL/Fedora

# CentOS/RHEL
sudo yum install doxygen graphviz

# Fedora
sudo dnf install doxygen graphviz

기본 사용법

1. 설정 파일 생성

프로젝트 루트 디렉토리에서:

doxygen -g Doxyfile

이 명령으로 Doxyfile이라는 설정 파일이 생성됩니다.

2. 기본 설정 수정

Doxyfile을 편집기로 열어 다음 항목들을 수정하세요:

# 프로젝트 이름
PROJECT_NAME = "My Project"

# 프로젝트 버전
PROJECT_NUMBER = "1.0"

# 입력 디렉토리 (소스 파일이 있는 경로)
INPUT = ./src

# 재귀적으로 하위 디렉토리 포함
RECURSIVE = YES

# 출력 디렉토리
OUTPUT_DIRECTORY = ./docs

# HTML 문서 생성
GENERATE_HTML = YES

# LaTeX 문서 생성 (필요한 경우)
GENERATE_LATEX = NO

# 파일 확장자 지정
FILE_PATTERNS = *.c *.cpp *.h *.hpp

# 소스 코드 포함
SOURCE_BROWSER = YES

# 그래프 생성 (graphviz 필요)
HAVE_DOT = YES

3. 문서 생성

doxygen Doxyfile

소스 코드 주석 작성법

Doxygen은 특별한 형태의 주석을 인식합니다. 주요 스타일들:

C/C++ 스타일 주석

/**
 * @brief 두 정수를 더하는 함수
 * 
 * 이 함수는 두 개의 정수를 받아서 그 합을 반환합니다.
 * 
 * @param a 첫 번째 정수
 * @param b 두 번째 정수
 * @return 두 정수의 합
 * 
 * @warning 오버플로우를 체크하지 않습니다
 * @see subtract()
 * 
 * Example:
 * @code
 * int result = add(5, 3);  // result는 8
 * @endcode
 */
int add(int a, int b) {
    return a + b;
}

/*!
 * \brief 클래스에 대한 설명
 * 
 * 이 클래스는 간단한 계산기 기능을 제공합니다.
 */
class Calculator {
private:
    int value;  ///< 현재 값을 저장하는 변수
    
public:
    /**
     * @brief 생성자
     * @param initial_value 초기값 (기본값: 0)
     */
    Calculator(int initial_value = 0);
    
    /// 소멸자
    ~Calculator();
};

주요 Doxygen 태그들

/**
 * @file calculator.h
 * @author 홍길동 (hong@example.com)
 * @date 2024-01-15
 * @version 1.0
 * @copyright Copyright (c) 2024
 * 
 * @brief 계산기 헤더 파일
 * @details 기본적인 산술 연산을 수행하는 함수들을 정의
 */

/**
 * @brief 함수 요약 설명
 * @details 함수에 대한 자세한 설명
 * 
 * @param[in] input_param 입력 매개변수
 * @param[out] output_param 출력 매개변수  
 * @param[in,out] inout_param 입출력 매개변수
 * 
 * @return 반환값 설명
 * @retval 0 성공
 * @retval -1 실패
 * 
 * @note 특별한 주의사항
 * @warning 경고사항
 * @todo 향후 개선사항
 * @bug 알려진 버그
 * 
 * @see 관련 함수나 클래스
 * @since 버전 1.0부터 사용 가능
 * @deprecated 더 이상 사용되지 않음
 * 
 * @code
 * // 사용 예제
 * int result = function_name(param);
 * @endcode
 */

고급 기능 활용

1. 그룹핑 (Grouping)

/**
 * @defgroup math_functions 수학 함수들
 * @brief 기본적인 수학 연산 함수들
 * @{
 */

/** @brief 덧셈 함수 */
int add(int a, int b);

/** @brief 뺄셈 함수 */
int subtract(int a, int b);

/** @} */ // end of math_functions group

2. 네임스페이스 문서화

/**
 * @namespace Utils
 * @brief 유틸리티 함수들을 포함하는 네임스페이스
 */
namespace Utils {
    /**
     * @brief 문자열 유틸리티 함수들
     */
    namespace String {
        /** @brief 문자열을 대문자로 변환 */
        std::string toUpper(const std::string& str);
    }
}

3. 이미지 및 다이어그램 포함

/**
 * @brief 복잡한 알고리즘 설명
 * 
 * 알고리즘의 흐름도:
 * @image html flowchart.png "알고리즘 흐름도"
 * @image latex flowchart.eps "알고리즘 흐름도" width=10cm
 * 
 * @dot
 * digraph example {
 *     A -> B -> C;
 *     A -> C;
 * }
 * @enddot
 */

고급 설정 옵션

Doxyfile 주요 설정들

# 프로젝트 설정
PROJECT_NAME = "프로젝트명"
PROJECT_NUMBER = "1.0.0"
PROJECT_BRIEF = "프로젝트 간단 설명"
PROJECT_LOGO = logo.png

# 입력 설정
INPUT = src include
RECURSIVE = YES
EXCLUDE = src/deprecated
EXCLUDE_PATTERNS = */test/* *_backup.* 

# 출력 설정
OUTPUT_DIRECTORY = documentation
CREATE_SUBDIRS = YES

# HTML 출력 설정
GENERATE_HTML = YES
HTML_OUTPUT = html
HTML_HEADER = custom_header.html
HTML_FOOTER = custom_footer.html
HTML_STYLESHEET = custom.css
HTML_COLORSTYLE_HUE = 220
HTML_COLORSTYLE_SAT = 100
HTML_COLORSTYLE_GAMMA = 80

# LaTeX 출력 설정
GENERATE_LATEX = YES
LATEX_OUTPUT = latex
PDF_HYPERLINKS = YES

# 소스 코드 브라우징
SOURCE_BROWSER = YES
INLINE_SOURCES = NO
STRIP_CODE_COMMENTS = YES
REFERENCED_BY_RELATION = YES
REFERENCES_RELATION = YES

# 그래프 생성
HAVE_DOT = YES
DOT_NUM_THREADS = 0
CLASS_GRAPH = YES
COLLABORATION_GRAPH = YES
GROUP_GRAPHS = YES
INCLUDE_GRAPH = YES
INCLUDED_BY_GRAPH = YES
CALL_GRAPH = YES
CALLER_GRAPH = YES
GRAPHICAL_HIERARCHY = YES
DIRECTORY_GRAPH = YES

# 검색 기능
SEARCHENGINE = YES
SERVER_BASED_SEARCH = NO

# 경고 설정
WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES
WARN_IF_DOC_ERROR = YES
WARN_NO_PARAMDOC = YES

실제 프로젝트 적용 예제

디렉토리 구조

my_project/
├── src/
│   ├── main.c
│   ├── calculator.c
│   └── utils.c
├── include/
│   ├── calculator.h
│   └── utils.h
├── docs/
├── Doxyfile
└── README.md

Makefile에 doxygen 통합

# Makefile
.PHONY: all clean docs

all: my_program

my_program: src/main.c src/calculator.c
	gcc -Iinclude -o $@ $^

docs:
	doxygen Doxyfile
	@echo "Documentation generated in docs/html/index.html"

clean:
	rm -f my_program
	rm -rf docs/html docs/latex

install-docs: docs
	cp -r docs/html/* /var/www/html/my_project_docs/

자동화 스크립트

문서 생성을 자동화하는 스크립트:

#!/bin/bash
# generate_docs.sh

echo "프로젝트 문서 생성 중..."

# 기존 문서 삭제
rm -rf docs/

# Doxygen 실행
if doxygen Doxyfile; then
    echo "✓ 문서 생성 완료"
    echo "HTML 문서: docs/html/index.html"
    
    # 웹 브라우저로 열기 (선택사항)
    if command -v xdg-open > /dev/null; then
        xdg-open docs/html/index.html
    fi
else
    echo "✗ 문서 생성 실패"
    exit 1
fi

# 문서 크기 출력
echo "생성된 문서 크기: $(du -sh docs/ | cut -f1)"

팁과 모범 사례

1. 주석 작성 가이드라인

  • 함수의 목적과 동작을 명확히 설명
  • 매개변수와 반환값을 항상 문서화
  • 예외 상황이나 제한사항 명시
  • 사용 예제 포함

2. 문서 품질 향상

# 문서화되지 않은 항목 확인
doxygen Doxyfile 2>&1 | grep -i warning

# 그래프 품질 향상을 위한 설정
DOT_IMAGE_FORMAT = svg
INTERACTIVE_SVG = YES
DOT_GRAPH_MAX_NODES = 100

3. CI/CD 통합

# GitHub Actions 예제
name: Generate Documentation
on: [push, pull_request]
jobs:
  docs:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - name: Install Doxygen
      run: sudo apt-get install doxygen graphviz
    - name: Generate docs
      run: doxygen Doxyfile
    - name: Deploy to GitHub Pages
      uses: peaceiris/actions-gh-pages@v3
      with:
        github_token: ${{ secrets.GITHUB_TOKEN }}
        publish_dir: ./docs/html

이제 Doxygen을 사용해서 전문적인 문서를 생성할 수 있습니다. 처음에는 기본 설정으로 시작해서 점차 고급 기능들을 추가해 나가시면 됩니다.

https://wikidocs.net/236278

+ Recent posts