I have a project for school.
In the root dir, I have 3 subdirs which all have a makefile (because there will be 3 executable files), and there is 1 lib dir.
This dir contains my library source files (
I have a makefile in the libdir:
## ## Makefile for corewar in /home/rihan_a/Projets/psu/corewar/lib ## ## Made by adnan rihan ## Login <firstname.lastname@example.org> ## ## Started on Fri Dec 9 09:28:07 2011 adnan rihan ## Last update Fri Dec 9 10:45:27 2011 adnan rihan ## NAME= libwar SRC= explode.c \ get.c \ has_char.c \ int_to_bigendian.c \ my_die.c \ my_getnbr_t.c \ my_memset.c \ my_power_rec.c \ my_putstr.c \ my_strcat.c \ my_strcmp.c \ my_strlen.c \ my_strncpy.c \ my_strndup.c \ op.c \ wt_len.c \ xmalloc.c OBJ= $(SRC:.c=.o) ARFLAGS= rcs CFLAGS= -Wall all: pack obj_dbg: $(CC) -g -c $(SRC) debug: obj_dbg all pack: $(OBJ) $(AR) $(ARFLAGS) $(NAME).a $(OBJ) clean: $(RM) $(OBJ) fclean: clean $(RM) $(NAME).a
My problem is when I do
make, everything is ok, and for
make debug also.
But when I do
make debug a second time, it doesn't remake the
.o, but does the
ar rcs everytime.
I want to avoid it, because when I request
make -C ../lib for the other makefiles, they all relink because the lib changed (because
ar was run each time).