0
# Macros
CC = gcc
COMP_FLAG = -std=c99 -Wall -pedantic-errors -Werror -DNDEBUG
LIB_FLAG = -L. -lmtm -lex1
# Main target
tests: yad3_test realtor_test customer_test
# Targets make <file>
yad3_test: yad3_test.o yad3.o realtor.o customer.o
$(CC) yad3_test.o yad3.o realtor.o customer.o $(LIB_FLAG) -o [email protected]
yad3_test.o: tests/yad3_test.c yad3.h customer.h realtor.h apartment_service.h apartment.h tests/test_utilities.h mtm_ex2.h
$(CC) -c $(COMP_FLAG) $(LIB_FLAG) tests/$*.c
yad3.o: yad3.c yad3.h customer.h realtor.h apartment_service.h apartment.h mtm_ex2.h list.h map.h
$(CC) -c $(COMP_FLAG) $(LIB_FLAG) $*.c
realtor.o: realtor.c realtor.h apartment_service.h apartment.h map.h
$(CC) -c $(COMP_FLAG) $(LIB_FLAG) $*.c
customer.o: customer.c map.h customer.h
$(CC) -c $(COMP_FLAG) $(LIB_FLAG) $*.c
realtor_test: realtor_test.o realtor.o
$(CC) realtor_test.o realtor.o $(LIB_FLAG) -o [email protected]
realtor_test.o: tests/realtor_test.c realtor.h apartment_service.h apartment.h tests/test_utilities.h
$(CC) -c $(COMP_FLAG) $(LIB_FLAG) tests/$*.c
#realtor.o: realtor.c realtor.h apartment_service.h apartment.h map.h
# $(CC) -c $(COMP_FLAG) $(LIB_FLAG) $*.c
customer_test: customer_test.o customer.o
$(CC) customer_test.o customer.o $(LIB_FLAG) -o [email protected]
customer_test.o: tests/customer_test.c customer.h tests/test_utilities.h
$(CC) -c $(COMP_FLAG) $(LIB_FLAG) tests/$*.c
#customer.o: customer.c map.h customer.h
# $(CC) -c $(COMP_FLAG) $(LIB_FLAG) $*.c
run: run_yad3_test run_realtor_test run_customer_test
run_clean: clean run
#run_my_set_test: my_set_test
# ./my_set_test
run_yad3_test: yad3_test
./yad3_test
realtor_test_test: realtor_test
./realtor_test
run_customer_test: customer_test
./customer_test
# Target remove all <*_test> and <*.o> files
clean: clean_o clean_test
clean_test:
rm -f *_test
clean_o:
rm -f *.o
コンパイルは正常に動作していますが、最終的に作成されたテストは正しく実行されません。ファイルはコンパイルされますが実行されません
正しく書かれているようですが、何らかの理由がありません。それは動作しません。誰にでも助けますか?
どちらもメインターゲットを、またそれは、依存関係がrun' 'に依存します。 'make run'を使って試してみるか、' tests'の依存関係として 'run'を追加してください – xvan
make runが動いています。しかし、私はそれが実行することを書くと、それを行うことが欲しい。 私は依存関係として追加しましたが、「run_realtor_testを作成するルールはありません」と書いています。 ??? – KittyT2016
このようなルールはないので、所有しているルールはrealtor_test_test – xvan