2019년 8월 30일 금요일

[C#/Mono] Makefile


Makefile

Visual Studio를 이용하지 않고, Mono Compllier를 이용하여 C# 파일들을 빌드한다. c#은 별도의 오브젝트파일을 만들지 않고 바로 최종 실행파일을 생성한다. 실행파일의 기본 아이콘과 프로그램 내부에서 사용하는 이미지 리소스들도 빌드 옵션으로 지정할 수 있다.


#
# csc File.cs 
# csc -out:My.exe File.cs
# csc -define:DEBUG -optimize -out:File2.exe *.cs
#
# csc -target:library File.cs
# csc -target:library -out:File2.dll -warn:0 -nologo -debug *.cs
# csc -target:library -out:Something.xyz *.cs
# 
# -target:exe,winexe,library,module

#
#Resources:
#   -linkresource:FILE[,ID] Links FILE as a resource (short: -linkres)
#   -resource:FILE[,ID]     Embed FILE as a resource (short: -res)
#   -win32res:FILE          Specifies Win32 resource file (.res)
#   -win32icon:FILE         Use this icon for the output
#   @file                   Read response file for more options
#

WLIB = wlib.dll
APPDEMO = wDemo.exe
APPMAIN = wMain.exe
APPWEB = wAppWeb.exe

MONO = D:\Dev\Mono\bin\mcs.bat

MAIN_SRC = wMain.cs \
 $(COMMON_SRC)

DEMO_SRC = wDemo.cs \

# $(COMMON_SRC)
 
WEB_SRC = wAppWeb.cs \
 $(COMMON_SRC)
 
COMMON_SRC = \
 wBorder.cs \
 wButton.cs \
 wCheckBox.cs \
 wComboBox.cs \
 wCtrl.cs \
 wDialog.cs \
 wFile.cs \
 wFlow.cs \
 wForm.cs \
 wGroupBox.cs \
 wLayoutTable.cs \
 wListBox.cs \
 wMenu.cs \
 wNet.cs \
 wPanel.cs \
 wPictureBox.cs \
 wProc.cs \
 wRichTextBox.cs \
 wSplit.cs \
 wStatus.cs \
 wStatusBar.cs \
 wTab.cs \
 wTextBox.cs \
 wTool.cs \
 wWeb.cs \
 wZip.cs \
 
OPT = -r:System,System.Drawing,System.Windows.Forms,wlib \
 -target:winexe -win32icon:form.ico \
 -res:exit.png,exit.png \
 -res:about.png,about.png \

WLIB_OPT = -r:System,System.Drawing,System.Windows.Forms \
 -r:System.IO.Compression,System.IO.Compression.FileSystem \
 -target:library
 
all: $(WLIB) $(APPDEMO)

clean:
 del $(APPMAIN) $(APPDEMO) $(APPWEB) $(WLIB)

$(APPMAIN): $(MAIN_SRC)
 $(MONO) -out:$(APPMAIN) $(MAIN_SRC) $(OPT)
 
$(APPDEMO): $(DEMO_SRC) $(WLIB)
 $(MONO) -out:$(APPDEMO) $(DEMO_SRC) $(OPT)
 
$(APPWEB): $(WEB_SRC)
 $(MONO) -out:$(APPWEB) $(WEB_SRC) $(OPT)

$(WLIB): $(COMMON_SRC)
 $(MONO) -out:$(WLIB) $(COMMON_SRC) $(WLIB_OPT) 

댓글 없음:

댓글 쓰기