Bare-bones makefile (not cmake) to build a playground application?


#1

It took me hours to make the playground code at least compilable. Now I’m getting lost in adding more and more and more and even more -lxyz and in getting more and more and even more error messages. Perhaps somebody is willing to help me? What I’d love to see is a simple, bare-bones Makefile that simply compiles and links, let’s say, the the tutorial01 without the cmake ado.

It’s not that I don’t like cmake, it’s just that I want to keep my stuff simple, and obviously, make is the mother of all *make tools. It took me years to fully unleash the power of make, at least within my brain, so I’d prefer to stick to one tool that I more or less fully understand instead of learning yet another one–over the next couple of years.

Thanks everyone who contribute and share their knowledge!

PS:
uname -a:
Linux kilo 4.9.0-4-amd64 #1 SMP Debian 4.9.65-3+deb9u1 (2017-12-23) x86_64 GNU/Linux

g++ -v:
Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Debian 6.3.0-18+deb9u1' --with-bugurl=file:///usr/share/doc/gcc-6/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-6 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-6-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-6-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-6-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 6.3.0 20170516 (Debian 6.3.0-18+deb9u1)

PPS: Because make is so simple, a single line like
g++ tutorial01.cpp -o tutorial01 ... -L/somewhere -lsomelib ...
would be a perfect answer! Thank you again!


#2

Are you able to use Instructions on building with makefiles and pkg-config on Unix?