Results 1 to 2 of 2
I have written a console program in C named main.c. I want to turn it into an application, so that using a Makefile and 'make' and 'make install' commands one ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 10-12-2011 #1
Creating Makefiles in Linux for installing programs
I want to turn it into an application, so that using a Makefile and 'make' and 'make install' commands one is able to install that in his/her computer.
Any ideas how to do that? I have searched tutorials for making the Makefile but they just tell me the way to compile the source files, not "install" them.
PS, I use Fedora 15 and Code::Blocks Ide, if that is of any help.
PPS : I have seen that copying the executable produced by gcc to /usr/bin directory does has the same result as installing. Is that what 'make install' command does?
- 10-12-2011 #2
- Join Date
- May 2011
Create a Makefile and put it in the same dir as your *.c file. Here's a very basic example of a Makefile:
CC = /usr/bin/gcc STRIP = /usr/bin/strip SRC = myprog.c OBJ = myprog.o EXE = myprog .c.o: $(INC) $(CC) $(CFLAGS) -c $*.c all: $(EXE) $(STRIP) $(EXE) clean: rm -f *.o rm -f *% $(EXE) $(EXE): $(OBJ) $(CC) -o $(EXE) $(OBJ) $(LIBS) install : cp $(EXE) $(BINDIR)