ifndef Toplevel.mak.included
Toplevel.mak.included := 1
-# Load top-level directory local configuration
+# Load top-level directory project configuration
sinclude $T/Config.mak
+# Load top-level directory local configuration
+sinclude $T/Config.local.mak
+
# Include the build system library
include $T/Makeit.mak
-# Use debug flavor by default
-F := dbg
-
-# C compiler
-CC := gcc
-
-# Use pre-compiled headers
-GCH := 1
-
-# Warn about everything
-override CPPFLAGS += -Wall
-override LDFLAGS += -Wall
-
-# Be standard compliant
-override CFLAGS += -std=c99 -pedantic
-override CXXFLAGS += -std=c++98 -pedantic
-
-
# Flavors (variants) flags
##########################
override LDFLAGS += -pg --coverage
endif
+# Common flags
+##############
+
+# Warn about everything
+override CPPFLAGS += -Wall
+override LDFLAGS += -Wall
+
+# Be standard compliant
+override CFLAGS += -std=c99 -pedantic
+override CXXFLAGS += -std=c++98 -pedantic
+
+# Other project configuration
+#############################
+
+# Use debug flavor by default
+F := dbg
+
+# Use pre-compiled headers
+GCH := 1
+
+
-This is a test/example for a nice Make based build system.
+This is a test/example for the Makeit build system.
-The Config.mak should not be saved to the repositories usually, but in this
-case it is because part of this demonstration is to show how to customize the
-build system through Config.mak, and specially to show how a project can be
-"embedded" into another tweaking the Config.mak.
+The Config.local.mak should not be saved to the repositories usually, it's
+supposed to be user configuration not visible to other users, but in
+this case it is because is part of this demonstration. Also, subproj's
+Config.local.mak shows how to make another project using Makeit behave as it was
+part of this project, as an "embedded" sub-project.
+
+This means you could copy subproj directory elsewhere, remove Config.local.mak
+and that should be a standalone project using Makeit. Tweaking ours
+Config.local.mak here, we integrate it into the build system, so doing make in
+our parent project will make subproj too.
lib1 is a standalone C library compiled into a shared object. lib2 is another
shared library which uses lib1 and otherproj, which is a standalone project
produces another standalone shared object. Finally, prog is a program which
uses lib1 and lib2.
-Every project have it's copy of Makeit.mak and it's own Toplevel.mak. Both
-files shouldn't be modified ever (unless you're hacking the build system).
+Every standalone project have it's copy of Makeit.mak and it's own Toplevel.mak.
+Both files shouldn't be modified ever (unless you're hacking the build system).
Then each directory containing some library or program to build (or directories
to include) has a Build.mak, which has only the logic to build the
--- /dev/null
+
+# Use the container project top-level directory as ours.
+T := ..
+
+# Define the default goal to the main target of this subproject when doing make
+# in this directory (you can use "all" to make the whole super-project).
+.DEFAULT_GOAL := otherproj
+
+# Include the "parent" project and local configuration.
+sinclude $T/Config.mak
+sinclude $T/Config.local.mak
+