Skip to content

Instantly share code, notes, and snippets.

@joeduffy
Last active May 25, 2016 22:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joeduffy/fe8a5ae322ffe63fac90535eb554237f to your computer and use it in GitHub Desktop.
Save joeduffy/fe8a5ae322ffe63fac90535eb554237f to your computer and use it in GitHub Desktop.
CSC=dotnet compile-csc
DOTNET=/usr/local/share/dotnet/shared/Microsoft.NETCore.App/1.0.0-rc2-3002702
CSREFS=\
--reference=$(DOTNET)/mscorlib.ni.dll \
--reference=$(DOTNET)/System.Runtime.dll \
--reference=$(DOTNET)/System.Console.dll
CSFLAGS=\
--emit-entry-point \
--warnings-as-errors \
--temp-output=./temp
SOURCES=$(shell find src -type f -name '*.cs')
BIN=bin
DLL=hello.dll
DBGOUT=$(BIN)/debug
DBGDLL=$(DBGOUT)/$(DLL)
RELOUT=$(BIN)/release
RELDLL=$(RELOUT)/$(DLL)
.PHONY: debug
debug: CSFLAGS += --define=DEBUG
debug: $(DBGDLL)
.PHONY: release
release: CSFLAGS += --optimize
release: $(RELDLL)
$(DBGDLL): $(SOURCES)
mkdir -p $(DBGOUT)
$(CSC) $(CSFLAGS) $(SOURCES) $(CSREFS) --out=$(DBGDLL)
$(RELDLL): $(SOURCES)
mkdir -p $(RELOUT)
$(CSC) $(CSFLAGS) $(SOURCES) $(CSREFS) --out=$(RELDLL)
clean:
$(RM) -rf $(BIN)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment