Ho il seguente makefile finora in questo momento ...Come rendere libreria statica in makefile
# Beginning of Makefile
OBJS = obj/shutil.o obj/parser.o obj/sshell.o
HEADER_FILES = include/shell.h include/parser.h
STATLIB = lib/libparser.a lib/libshell.a
EXECUTABLE = sshell
CFLAGS = -Wall
CC = gcc
# End of configuration options
#What needs to be built to make all files and dependencies
all: $(EXECUTABLE) $(STATLIB)
#Create the main executable
$(EXECUTABLE): $(OBJS)
$(CC) -o $(EXECUTABLE) $(OBJS)
$(STATLIB): $(
#Recursively build object files
obj/%.o: src/%.c
$(CC) $(CFLAGS) -I./include -c -o [email protected] $<
#Define dependencies for objects based on header files
#We are overly conservative here, parser.o should depend on parser.h only
$(OBJS) : $(HEADER_FILES)
clean:
-rm -f $(EXECUTABLE) obj/*.o
-rm -f lib/*.a
run: $(EXECUTABLE)
./$(EXECUTABLE)
tarball:
-rm -f $(EXECUTABLE) *.o
(cd .. ; tar czf Your_Name_a1.tar.z shell)
# End of Makefile
Sto cercando di generare librerie statiche libparser.a e libshell.a
non ho idea di come creare queste librerie statiche ...
http://www.adp-gmbh.ch/cpp/gcc/create_lib.html –