Search Unity

Makefile for a .net dll

Discussion in 'Scripting' started by AngryAnt, Mar 28, 2008.

  1. AngryAnt

    AngryAnt

    Keyboard Operator

    Joined:
    Oct 25, 2005
    Posts:
    3,045
    Hey. I'm trying to compile some C# scripts into a .net dll, but I'm completely green to makefile writing - been sheltered too much by IDEs.

    This is my best attempt at a file so far:
    Code (csharp):
    1. SRCS=Sources/*.cs
    2. LIBS=/Applications/Unity/Unity.app/Contents/Frameworks/UnityEngine.dll
    3. OUT=Path.dll
    4.  
    5. Path.dll: $(SRCS)
    6.     gmcs -r:$(LIBS) -target:library -out:$(OUT) $(SRCS)
    7.  
    8. all: Path.dll
    When run I get the following error:
    Code (csharp):
    1. Makefile:6: *** multiple target patterns.  Stop.
    I'm drawing a blank on what may have caused the problem and how to solve it. Help please :cry:
     
  2. NCarter

    NCarter

    Joined:
    Sep 3, 2005
    Posts:
    686
    This works for me:

    Code (csharp):
    1. SRCS=Sources/*.cs
    2. LIBS=/Applications/Unity/Unity.app/Contents/Frameworks/UnityEngine.dll
    3. OUT=Path.dll
    4.  
    5. Path:
    6.     gmcs -r:$(LIBS) -target:library -out:$(OUT) $(SRCS)
    7.  
    8. all: Path
    It seems that make requires that you use a tab before 'gmcs'. Spaces aren't sufficient.

    I'm not sure if the other changes I made were necessary, since, as I said on IRC, I only learnt enough about make to solve my particular problem. You might still want to read the documentation so that you understand what's really happening. ;)
     
  3. AngryAnt

    AngryAnt

    Keyboard Operator

    Joined:
    Oct 25, 2005
    Posts:
    3,045
    The tab was the key. Thanks a lot :)
     
  4. andeeeee

    andeeeee

    Joined:
    Jul 19, 2005
    Posts:
    8,768
    NAnt (http://nant.sourceforge.net/) is a nice .NET-centric build tool. It was developed specifically to get around the nuisances of using makefiles.
     
  5. AngryAnt

    AngryAnt

    Keyboard Operator

    Joined:
    Oct 25, 2005
    Posts:
    3,045
    Thanks for the link andeee. Packaged the makefile and a shell scrip inside a nice double-click-me app bundle though so I'm quite happy :)