makefile 876 Bytes
Newer Older
Bertrand Marc committed
1 2 3 4 5 6 7 8 9
CC=gcc
CFLAGS=-Wall -Wextra -pedantic -std=c99
LDFLAGS=
SRC= $(wildcard *.c)
OBJ= $(SRC:.c=.o)
EXEC=libsas7bdat

all: $(EXEC)

10 11 12
write: $(OBJ) examples/write.o
	$(CC) -o $@ $^ $(LDFLAGS)

Bertrand Marc committed
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
$(EXEC): $(OBJ) examples/test.o
	$(CC) -o $@ $^ $(LDFLAGS)

csv: $(OBJ) examples/sas7bdat2csv.o
	$(CC) -o $(EXEC) $^ $(LDFLAGS)

static: $(OBJ)
	ar rcs $(EXEC).a $(OBJ)

%.o: %.c %d
	$(CC) -o $@ -c $< $(CFLAGS)

clean:
	rm -f *.o *.a $(EXEC) *.exe *.d *.stackdump test.log test.csv examples/*.o examples/*.d

test: $(EXEC)
	@for file in ../datasets/*.sas7bdat ; do \
		# echo $$file ; \
		./libsas7bdat $$file ; \
	done > test.log 2>&1

run: $(EXEC)
	./$(EXEC)

memtest: csv
	valgrind --leak-check=yes ./$(EXEC) ../datasets/applican.sas7bdat test.csv

.PHONY: clean run tarball

-include $(SRC:.c=.d)

%.d: %.c
	@$(CC) -MM -MF $@ $^ $(CFLAGS)

tarball: clean
	tar -cjf ../$(EXEC).tar.bz2 .