I currently have a makefile that when run will link a .h and .c file and then create a binary. Is it possible to make the makefile execute this binary by just doing make followed by an input file_name ?
My makefile looks something like this:
CC = g++
cppflags = "-std=c++0x"
all : interpreter
byte.o : opcode.h byte.h byte.cpp
$(CC) -c $(cppflags) byte.cpp
interpreter : byte.o main.cpp
$(CC) $(cppflags) byte.o main.cpp -o interpreter
If I do make
I'll get an executable interpreter
that takes the name of an input file as an argument. What I want to do is modify my makefile so that I can do make <file_name>
making the makefile run the executable instead of having to use the binary created by the make I already have. The input file name can not be hard coded.