changed the way of building in Makefiles

This commit is contained in:
Tomasz Sowa 2021-05-17 03:20:51 +02:00
parent da6a36a205
commit fe82f63efb
2 changed files with 16 additions and 9 deletions

View File

@ -5,7 +5,7 @@ export CXXFLAGS
export AR export AR
all: src tests all: src
src: FORCE src: FORCE
@ -13,9 +13,15 @@ src: FORCE
tests: FORCE tests: FORCE
$(MAKE) -C src
$(MAKE) -C tests $(MAKE) -C tests
tests-gcc10: FORCE
env CXX=g++10 CXXFLAGS="-Wl,-rpath=/usr/local/lib/gcc10/ -Wall -pedantic -O0 -g3 -std=c++20 -I../src -I/usr/local/include" $(MAKE) -C src
env CXX=g++10 CXXFLAGS="-Wl,-rpath=/usr/local/lib/gcc10/ -Wall -pedantic -O0 -g3 -std=c++20 -I../src -I/usr/local/include" $(MAKE) -C tests
clean: FORCE clean: FORCE
$(MAKE) -C src clean $(MAKE) -C src clean
$(MAKE) -C tests clean $(MAKE) -C tests clean
@ -26,5 +32,7 @@ depend: FORCE
$(MAKE) -C tests depend $(MAKE) -C tests depend
FORCE: FORCE:

View File

@ -11,27 +11,23 @@ CXXFLAGS = -Wall -pedantic -O2 -std=c++20 -I../src -I/usr/local/include
endif endif
progname = tests progname = tests
pikotoolslibfile = ../src/pikotools.a
all: $(progname) pikotools all: $(progname)
$(progname): $(objfiles) pikotools $(progname): $(objfiles) FORCE
$(CXX) $(CXXFLAGS) -o $(progname) $(objfiles) ../src/pikotools.a $(CXX) $(CXXFLAGS) -o $(progname) $(objfiles) $(pikotoolslibfile)
%.o: %.cpp %.o: %.cpp
$(CXX) -c $(CXXFLAGS) -o $@ $< $(CXX) -c $(CXXFLAGS) -o $@ $<
pikotools: FORCE
$(MAKE) -C ../src
FORCE:
clean: clean:
rm -f $(objfiles) rm -f $(objfiles)
@ -42,5 +38,8 @@ depend:
makedepend -Y. -I../src -f- $(sourcefiles) > Makefile.dep makedepend -Y. -I../src -f- $(sourcefiles) > Makefile.dep
FORCE:
-include Makefile.dep -include Makefile.dep