libscomp/Makefile

33 lines
869 B
Makefile
Raw Normal View History

2021-07-31 20:39:04 -04:00
OUT=libscomp.a
2021-08-09 13:51:38 -04:00
VERSION=0.1.0
2021-07-30 23:57:22 -04:00
TESTS=test/input test/exec
2021-07-10 15:10:00 -04:00
2021-08-09 13:52:52 -04:00
all: $(OUT) libscomp_amalg.c libscomp_amalg.h
2021-07-31 20:39:04 -04:00
$(OUT): input.o exec.o
$(AR) rcs $(OUT) input.o exec.o
2021-07-10 15:10:00 -04:00
tests: $(TESTS)
2021-07-10 15:43:39 -04:00
for i in $(TESTS); do ./$$i -v; done
2021-07-10 15:10:00 -04:00
2021-08-09 13:52:52 -04:00
libscomp_amalg.h: exec.h input.h
echo '#pragma once' > libscomp_amalg.h
echo '#define LIBSCOMP_VERSION "${VERSION}"' >> libscomp_amalg.h
2021-08-09 13:45:05 -04:00
cat input.h exec.h | \
sed 's/#pragma .*//g; s/#include ".*//g' \
2021-08-09 13:52:52 -04:00
>> libscomp_amalg.h
2021-08-09 13:45:05 -04:00
2021-08-09 13:52:52 -04:00
libscomp_amalg.c: exec.c input.c
echo '#include "libscomp_amalg.h"' > libscomp_amalg.c
2021-08-09 13:45:05 -04:00
cat exec.c input.c | sed 's/#include ".*//g' \
2021-08-09 13:52:52 -04:00
>> libscomp_amalg.c
2021-08-09 13:45:05 -04:00
2021-07-30 23:57:22 -04:00
TEST_EXEC=test/exec.o exec.o
test/exec: $(TEST_EXEC)
$(CC) -Wall $(TEST_EXEC) -o test/exec
2021-07-10 15:10:00 -04:00
TEST_INPUT=test/input.o input.o
test/input: $(TEST_INPUT)
$(CC) -Wall $(TEST_INPUT) -o test/input
.c.o:
2021-07-30 23:57:22 -04:00
$(CC) -g -std=c89 -Wall -c $< -o $@
2021-07-31 20:42:30 -04:00
clean:
$(RM) $(TESTS) $(OUT) *.o