David Turner | 046f7a0 | 2000-09-15 22:42:06 +0000 | [diff] [blame] | 1 | # |
| 2 | # FreeType build system -- top-level sub-Makefile |
| 3 | # |
| 4 | |
| 5 | # Copyright 2000 by David Turner |
| 6 | |
| 7 | |
| 8 | # This file is designed for GNU Make, do not use it with another Make tool! |
| 9 | # |
| 10 | # It works as follows: |
| 11 | # |
| 12 | # - When invoked for the first time, this Makefile will include the rules |
| 13 | # found in `PROJECT/builds/detect.mk'. They are in charge of detecting |
| 14 | # the current platform. |
| 15 | # |
| 16 | # A summary of the detection will be displayed, and the file `config.mk' |
| 17 | # will be created in the current directory. |
| 18 | # |
| 19 | # - When invoked later, this Makefile will include the rules found in |
| 20 | # `config.mk'. This sub-Makefile will define some system-specific |
| 21 | # variables (like compiler, compilation flags, object suffix, etc.), then |
| 22 | # include the rules found in `PROJECT/builds/PROJECT.mk', used to build |
| 23 | # the library. |
| 24 | # |
| 25 | # See the comments in `builds/detect.mk' and `builds/PROJECT.mk' for more |
| 26 | # details on host platform detection and library builds. |
| 27 | |
| 28 | |
| 29 | .PHONY: setup |
| 30 | |
David Turner | beece1b | 2000-09-19 18:33:20 +0000 | [diff] [blame] | 31 | ifndef CONFIG_MK |
David Turner | 046f7a0 | 2000-09-15 22:42:06 +0000 | [diff] [blame] | 32 | CONFIG_MK := config.mk |
David Turner | beece1b | 2000-09-19 18:33:20 +0000 | [diff] [blame] | 33 | endif |
David Turner | 046f7a0 | 2000-09-15 22:42:06 +0000 | [diff] [blame] | 34 | |
| 35 | # If no configuration sub-makefile is present, or if `setup' is the target |
| 36 | # to be built, run the auto-detection rules to figure out which |
| 37 | # configuration rules file to use. |
| 38 | # |
| 39 | # Note that the configuration file is put in the current directory, which is |
| 40 | # not necessarily $(TOP). |
| 41 | |
| 42 | # If `config.mk' is not present, set `check_platform'. |
| 43 | # |
| 44 | ifeq ($(wildcard $(CONFIG_MK)),) |
| 45 | check_platform := 1 |
| 46 | endif |
| 47 | |
| 48 | # If `setup' is one of the targets requested, set `check_platform'. |
| 49 | # |
| 50 | ifneq ($(findstring setup,$(MAKECMDGOALS)),) |
| 51 | check_platform := 1 |
| 52 | endif |
| 53 | |
| 54 | # Include the automatic host platform detection rules when we need to |
| 55 | # check the platform. |
| 56 | # |
| 57 | ifdef check_platform |
| 58 | |
| 59 | all: setup |
| 60 | |
Werner Lemberg | bd547dc | 2000-09-22 21:23:29 +0000 | [diff] [blame] | 61 | ifdef USE_MODULES |
| 62 | # If the module list $(MODULE_LIST) file is not present, generate it. |
| 63 | # |
| 64 | #modules: make_module_list setup |
| 65 | endif |
David Turner | 046f7a0 | 2000-09-15 22:42:06 +0000 | [diff] [blame] | 66 | |
| 67 | include $(TOP)/builds/detect.mk |
| 68 | |
Werner Lemberg | bd547dc | 2000-09-22 21:23:29 +0000 | [diff] [blame] | 69 | ifdef USE_MODULES |
| 70 | include $(TOP)/builds/modules.mk |
David Turner | 046f7a0 | 2000-09-15 22:42:06 +0000 | [diff] [blame] | 71 | |
Werner Lemberg | bd547dc | 2000-09-22 21:23:29 +0000 | [diff] [blame] | 72 | ifeq ($(wildcard $(MODULE_LIST)),) |
| 73 | setup: make_module_list |
| 74 | endif |
David Turner | 046f7a0 | 2000-09-15 22:42:06 +0000 | [diff] [blame] | 75 | endif |
David Turner | 046f7a0 | 2000-09-15 22:42:06 +0000 | [diff] [blame] | 76 | |
| 77 | # This rule makes sense for Unix only to remove files created by a run |
| 78 | # of the configure script which hasn't been successful (so that no |
| 79 | # `config.mk' has been created). It uses the built-in $(RM) command of |
| 80 | # GNU make. |
| 81 | # |
| 82 | distclean: |
Werner Lemberg | bd547dc | 2000-09-22 21:23:29 +0000 | [diff] [blame] | 83 | $(RM) builds/unix/config.cache |
| 84 | $(RM) builds/unix/config.log |
| 85 | $(RM) builds/unix/config.status |
| 86 | $(RM) builds/unix/unix-def.mk |
| 87 | $(RM) builds/unix/unix-cc.mk |
David Turner | 046f7a0 | 2000-09-15 22:42:06 +0000 | [diff] [blame] | 88 | |
| 89 | # IMPORTANT: |
| 90 | # |
| 91 | # `setup' must be defined by the host platform detection rules to create |
| 92 | # the `config.mk' file in the current directory. |
| 93 | |
| 94 | else |
| 95 | |
| 96 | # A configuration sub-Makefile is present -- simply run it. |
| 97 | # |
| 98 | all: single |
| 99 | |
Werner Lemberg | bd547dc | 2000-09-22 21:23:29 +0000 | [diff] [blame] | 100 | ifdef USE_MODULES |
| 101 | modules: make_module_list |
| 102 | endif |
David Turner | 046f7a0 | 2000-09-15 22:42:06 +0000 | [diff] [blame] | 103 | |
| 104 | BUILD_PROJECT := yes |
| 105 | include $(CONFIG_MK) |
| 106 | |
| 107 | endif # test check_platform |
| 108 | |
| 109 | # EOF |