Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make a Makefile shorter?

Tags:

makefile

I've got the following Makefile:

all: hello.exe hellogtk.exe hellogtktng.cs

hello.exe: hello.cs
 gmcs hello.cs

hellogtk.exe: hellogtk.cs
 gmcs -pkg:gtk-sharp-2.0 hellogtk.cs

hellogtktng.exe: hellogtktng.cs
 gmcs -pkg:gtk-sharp-2.0 hellogtktng.cs

clean:
 rm -f *.exe

I'm only starting to learn how to write Makefiles, and I feel that all this is a bit repetitive. How would Makefile pros go about doing this?

like image 973
theone Avatar asked Dec 12 '22 20:12

theone


1 Answers

all: hello.exe hellogtk.exe hellogtktng.exe

%.exe: %.cs
 gmcs -pkg:gtk-sharp-2.0 $<

clean:
 rm -f *.exe
like image 183
Forrest Voight Avatar answered Jan 03 '23 08:01

Forrest Voight