CC = /usr/bin/g++ CFLAGS := -Wall -O3 -std=c++11 LIBFUNC = /usr/lib/libfunc.so .PHONY: all all: main.o $(LIBFUNC) $(CC) $(CFLAGS) main.o -lfunc -o run.exe $(LIBFUNC): function.cpp function.h sudo $(CC) $(CFLAGS) -fPIC -shared -c function.cpp -o $(LIBFUNC) main.o: main.cpp function.h $(CC) $(CFLAGS) -c main.cpp -o main.o .PHONY: clean clean: rm -f *.o run.exe sudo rm $(LIBFUNC)