Convert package from C++ to C.
[assignment-template.git] / Makefile
index b28804ac327ad720b81e596bf546c793a6b49a12..022ef268abdfb6f2fa597b3909610a433a224c66 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -27,7 +27,7 @@ RELEASE = $(COURSE)-$(PACKAGE)-$(VERSION)
 PROGRAM = hello_world
 
 # Define the source files that will be distributed in the tarball
-SOURCE = *.cpp COPYING Makefile README
+SOURCE = *.c COPYING Makefile README
 
 # Define a list of object files needed to link PROGRAM
 OBJECTS = $(PROGRAM).o
@@ -72,7 +72,7 @@ dist:
 # target: hello_world - compile the hello_world program
 # Use GCC to link the program from object files.
 $(PROGRAM): $(OBJECTS)
-       $(CXX) $(LDFLAGS) -o $@ $^ $(LIBS)
+       $(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
 
 # target: run - use the program for its intended purpose
 # Here we just execute PROGRAM, but you could also use something like
@@ -97,3 +97,8 @@ run: $(PROGRAM)
 #    $ make CXX=/usr/local/bin/g++ CXXFLAGS=-Wall
 %.o: %.cpp
        $(CXX) $(CXXFLAGS) -c $<
+
+# Matching rule for compiling object files from C source
+# The comments from the C++ rule above also apply here
+%.o: %.c
+       $(CC) $(CFLAGS) -c $<