simplify some of the build rules
1 2 3 4 5 6 7 8 9 10 11 12 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 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
diff --git a/makefile b/makefile
index beab4fc..8de82d1 100644
--- a/makefile
+++ b/makefile
@@ -17,7 +17,7 @@ coverage: LIBNAME:=-Wl,--whole-archive $(LIBNAME) -Wl,--no-whole-archive
include makefile_include.mk
-%.o: %.c
+%.o: %.c $(HEADERS)
ifneq ($V,1)
@echo " * ${CC} $@"
endif
@@ -58,8 +58,6 @@ bn_s_mp_sqr.o bn_s_mp_sqr_fast.o bn_s_mp_sub.o bn_s_mp_toom_mul.o bn_s_mp_toom_s
#END_INS
-$(OBJECTS): $(HEADERS)
-
$(LIBNAME): $(OBJECTS)
$(AR) $(ARFLAGS) $@ $(OBJECTS)
$(RANLIB) $@
@@ -97,10 +95,7 @@ uninstall:
rm $(DESTDIR)$(LIBPATH)/$(LIBNAME)
rm $(HEADERS_PUB:%=$(DESTDIR)$(INCPATH)/%)
-test: demo/main.o demo/opponent.o demo/test.o $(LIBNAME)
- $(CC) $(CFLAGS) $^ $(LFLAGS) -o test
-
-test_standalone: demo/main.o demo/opponent.o demo/test.o $(LIBNAME)
+test test_standalone: demo/main.o demo/opponent.o demo/test.o $(LIBNAME)
$(CC) $(CFLAGS) $^ $(LFLAGS) -o test
.PHONY: mtest
diff --git a/makefile.shared b/makefile.shared
index 25e2fe5..e6bb1ef 100644
--- a/makefile.shared
+++ b/makefile.shared
@@ -57,7 +57,7 @@ bn_s_mp_sqr.o bn_s_mp_sqr_fast.o bn_s_mp_sub.o bn_s_mp_toom_mul.o bn_s_mp_toom_s
objs: $(OBJECTS)
-.c.o:
+.c.o: $(HEADERS)
$(LTCOMPILE) $(CFLAGS) $(LDFLAGS) -o $@ -c $<
LOBJECTS = $(OBJECTS:.o=.lo)
@@ -79,17 +79,8 @@ uninstall:
rm $(HEADERS_PUB:%=$(DESTDIR)$(INCPATH)/%)
rm $(DESTDIR)$(LIBPATH)/pkgconfig/libtommath.pc
-test: $(LIBNAME)
- $(LTCOMPILE) $(CFLAGS) -c demo/main.c -o demo/main.o
- $(LTCOMPILE) $(CFLAGS) -c demo/opponent.c -o demo/opponent.o
- $(LTCOMPILE) $(CFLAGS) -c demo/test.c -o demo/test.o
- $(LTLINK) $(LDFLAGS) -o test demo/main.o demo/opponent.o demo/test.o $(LIBNAME)
-
-test_standalone: $(LIBNAME)
- $(LTCOMPILE) $(CFLAGS) -c demo/main.c -o demo/main.o
- $(LTCOMPILE) $(CFLAGS) -c demo/opponent.c -o demo/opponent.o
- $(LTCOMPILE) $(CFLAGS) -c demo/test.c -o demo/test.o
- $(LTLINK) $(LDFLAGS) -o test demo/main.o demo/opponent.o demo/test.o $(LIBNAME)
+test test_standalone: demo/main.o demo/opponent.o demo/test.o $(LIBNAME)
+ $(LTLINK) $(LDFLAGS) $^ -o test
.PHONY: mtest
mtest: