# makefile
VPATH = src:include
SRC = src
LIB = lib
CFLAGS = -I include
objects = main.c util.o temp.o libhello.so
cc = gcc
hello.e: $(objects)
$(cc) -o hello.e $(CFLAGS) $< -L $(LIB) -lhello
libhello.so: util.o temp.o
$(cc) -shared -o $(LIB)/libhello.so $^
temp.o: temp.c temp.h
$(cc) -c -fpic $(CFLAGS) $< -o $@
util.o: util.c util.h
$(cc) -c -fpic $(CFLAGS) $< -o $@
.PHONY: clean
clean: # no dependencies, not implemented automatically
rm -f *.o *.e *~ $(LIB)/*.so
# makefile
VPATH = src:include
SRC = src
LIB = lib
CFLAGS = -I include
objects = main.c util.o temp.o libhello.a
cc = gcc
hello.e: $(objects)
$(cc) -o hello.e $(CFLAGS) $< -L $(LIB) -lhello
libhello.a: util.o temp.o
ar rcs $(LIB)/libhello.a $^
temp.o: temp.c temp.h
$(cc) -c $(CFLAGS) $< -o $@
util.o: util.c util.h
$(cc) -c $(CFLAGS) $< -o $@
.PHONY: clean
clean: # no dependencies, not implemented automatically
rm -f *.o *.e *~ $(LIB)/*.a