Makefile
474 Bytes
TARGET=toto
DIR_TARGET=./toto_lib
CFLAGS=-Wall -pedantic -Wextra -I $(DIR_TARGET)
CLIB=ar cq
CC=gcc
all: $(TARGET).a
debug: CFLAGS += -g -DDEBUG
debug: all
clean:
rm -f *.o *.a
rm -f $(DIR_TARGET)/$(TARGET).a
rm -f $(DIR_TARGET)/$(TARGET).h
$(TARGET).o: $(TARGET).c $(TARGET).h
$(CC) -c $(CFLAGS) -o $@ $<
$(TARGET).a: $(TARGET).o
rm -rf $@
$(CLIB) $@ $+
mkdir $(DIR_TARGET) -p
cp $(TARGET).a $(DIR_TARGET)/$(TARGET).a
cp $(TARGET).h $(DIR_TARGET)/$(TARGET).h