David Turner | 046f7a0 | 2000-09-15 22:42:06 +0000 | [diff] [blame] | 1 | # |
| 2 | # FreeType build system -- top-level sub-Makefile |
| 3 | # |
| 4 | |
Werner Lemberg | 47a5f41 | 2000-10-17 03:38:43 +0000 | [diff] [blame] | 5 | |
| 6 | # Copyright 1996-2000 by |
| 7 | # David Turner, Robert Wilhelm, and Werner Lemberg. |
| 8 | # |
| 9 | # This file is part of the FreeType project, and may only be used, modified, |
| 10 | # and distributed under the terms of the FreeType project license, |
| 11 | # LICENSE.TXT. By continuing to use, modify, or distribute this file you |
| 12 | # indicate that you have read the license and understand and accept it |
| 13 | # fully. |
David Turner | 046f7a0 | 2000-09-15 22:42:06 +0000 | [diff] [blame] | 14 | |
| 15 | |
| 16 | # This file is designed for GNU Make, do not use it with another Make tool! |
| 17 | # |
| 18 | # It works as follows: |
| 19 | # |
| 20 | # - When invoked for the first time, this Makefile will include the rules |
| 21 | # found in `PROJECT/builds/detect.mk'. They are in charge of detecting |
| 22 | # the current platform. |
| 23 | # |
| 24 | # A summary of the detection will be displayed, and the file `config.mk' |
| 25 | # will be created in the current directory. |
| 26 | # |
| 27 | # - When invoked later, this Makefile will include the rules found in |
| 28 | # `config.mk'. This sub-Makefile will define some system-specific |
| 29 | # variables (like compiler, compilation flags, object suffix, etc.), then |
| 30 | # include the rules found in `PROJECT/builds/PROJECT.mk', used to build |
| 31 | # the library. |
| 32 | # |
| 33 | # See the comments in `builds/detect.mk' and `builds/PROJECT.mk' for more |
| 34 | # details on host platform detection and library builds. |
| 35 | |
| 36 | |
Werner Lemberg | 594f0c9 | 2000-12-20 22:09:41 +0000 | [diff] [blame] | 37 | .PHONY: all setup distclean modules |
David Turner | 046f7a0 | 2000-09-15 22:42:06 +0000 | [diff] [blame] | 38 | |
Werner Lemberg | 91481f8 | 2000-11-04 23:41:02 +0000 | [diff] [blame] | 39 | # The `space' variable is used to avoid trailing spaces in defining the |
| 40 | # `T' variable later. |
| 41 | # |
| 42 | empty := |
| 43 | space := $(empty) $(empty) |
| 44 | |
| 45 | |
David Turner | beece1b | 2000-09-19 18:33:20 +0000 | [diff] [blame] | 46 | ifndef CONFIG_MK |
Werner Lemberg | 4b92cf8 | 2000-10-10 03:58:32 +0000 | [diff] [blame] | 47 | CONFIG_MK := config.mk |
David Turner | beece1b | 2000-09-19 18:33:20 +0000 | [diff] [blame] | 48 | endif |
David Turner | 046f7a0 | 2000-09-15 22:42:06 +0000 | [diff] [blame] | 49 | |
| 50 | # If no configuration sub-makefile is present, or if `setup' is the target |
| 51 | # to be built, run the auto-detection rules to figure out which |
| 52 | # configuration rules file to use. |
| 53 | # |
| 54 | # Note that the configuration file is put in the current directory, which is |
| 55 | # not necessarily $(TOP). |
| 56 | |
| 57 | # If `config.mk' is not present, set `check_platform'. |
| 58 | # |
| 59 | ifeq ($(wildcard $(CONFIG_MK)),) |
| 60 | check_platform := 1 |
| 61 | endif |
| 62 | |
| 63 | # If `setup' is one of the targets requested, set `check_platform'. |
| 64 | # |
| 65 | ifneq ($(findstring setup,$(MAKECMDGOALS)),) |
| 66 | check_platform := 1 |
| 67 | endif |
| 68 | |
| 69 | # Include the automatic host platform detection rules when we need to |
| 70 | # check the platform. |
| 71 | # |
| 72 | ifdef check_platform |
| 73 | |
Werner Lemberg | 594f0c9 | 2000-12-20 22:09:41 +0000 | [diff] [blame] | 74 | # This is the first rule `make' sees. |
| 75 | # |
David Turner | 046f7a0 | 2000-09-15 22:42:06 +0000 | [diff] [blame] | 76 | all: setup |
| 77 | |
Werner Lemberg | e4b32a5 | 2000-10-31 20:42:18 +0000 | [diff] [blame] | 78 | ifdef USE_MODULES |
Werner Lemberg | bd547dc | 2000-09-22 21:23:29 +0000 | [diff] [blame] | 79 | # If the module list $(MODULE_LIST) file is not present, generate it. |
| 80 | # |
| 81 | #modules: make_module_list setup |
| 82 | endif |
David Turner | 046f7a0 | 2000-09-15 22:42:06 +0000 | [diff] [blame] | 83 | |
| 84 | include $(TOP)/builds/detect.mk |
| 85 | |
Werner Lemberg | e4b32a5 | 2000-10-31 20:42:18 +0000 | [diff] [blame] | 86 | ifdef USE_MODULES |
Werner Lemberg | bd547dc | 2000-09-22 21:23:29 +0000 | [diff] [blame] | 87 | include $(TOP)/builds/modules.mk |
David Turner | 046f7a0 | 2000-09-15 22:42:06 +0000 | [diff] [blame] | 88 | |
Werner Lemberg | bd547dc | 2000-09-22 21:23:29 +0000 | [diff] [blame] | 89 | ifeq ($(wildcard $(MODULE_LIST)),) |
| 90 | setup: make_module_list |
| 91 | endif |
David Turner | 046f7a0 | 2000-09-15 22:42:06 +0000 | [diff] [blame] | 92 | endif |
David Turner | 046f7a0 | 2000-09-15 22:42:06 +0000 | [diff] [blame] | 93 | |
| 94 | # This rule makes sense for Unix only to remove files created by a run |
| 95 | # of the configure script which hasn't been successful (so that no |
| 96 | # `config.mk' has been created). It uses the built-in $(RM) command of |
Werner Lemberg | 594f0c9 | 2000-12-20 22:09:41 +0000 | [diff] [blame] | 97 | # GNU make. Similarly, `nul' is created if e.g. `make setup win32' has |
| 98 | # been erroneously used. |
David Turner | 046f7a0 | 2000-09-15 22:42:06 +0000 | [diff] [blame] | 99 | # |
Werner Lemberg | a64c55b | 2001-05-12 06:40:50 +0000 | [diff] [blame] | 100 | # note: This test is duplicated in "builds/toplevel.mk". |
| 101 | # |
Werner Lemberg | 3836415 | 2001-06-20 08:06:50 +0000 | [diff] [blame] | 102 | is_unix := $(strip $(wildcard /sbin/init) $(wildcard /usr/sbin/init) $(wildcard /hurd/auth)) |
David Turner | ebe85f5 | 2001-05-11 14:25:57 +0000 | [diff] [blame] | 103 | ifneq ($(is_unix),) |
| 104 | |
David Turner | ebe85f5 | 2001-05-11 14:25:57 +0000 | [diff] [blame] | 105 | distclean: |
Werner Lemberg | bd547dc | 2000-09-22 21:23:29 +0000 | [diff] [blame] | 106 | $(RM) builds/unix/config.cache |
| 107 | $(RM) builds/unix/config.log |
| 108 | $(RM) builds/unix/config.status |
| 109 | $(RM) builds/unix/unix-def.mk |
| 110 | $(RM) builds/unix/unix-cc.mk |
Werner Lemberg | 594f0c9 | 2000-12-20 22:09:41 +0000 | [diff] [blame] | 111 | $(RM) nul |
David Turner | 046f7a0 | 2000-09-15 22:42:06 +0000 | [diff] [blame] | 112 | |
David Turner | ebe85f5 | 2001-05-11 14:25:57 +0000 | [diff] [blame] | 113 | endif # test is_unix |
| 114 | |
David Turner | 046f7a0 | 2000-09-15 22:42:06 +0000 | [diff] [blame] | 115 | # IMPORTANT: |
| 116 | # |
| 117 | # `setup' must be defined by the host platform detection rules to create |
| 118 | # the `config.mk' file in the current directory. |
| 119 | |
| 120 | else |
| 121 | |
| 122 | # A configuration sub-Makefile is present -- simply run it. |
| 123 | # |
| 124 | all: single |
| 125 | |
Werner Lemberg | bd547dc | 2000-09-22 21:23:29 +0000 | [diff] [blame] | 126 | ifdef USE_MODULES |
| 127 | modules: make_module_list |
| 128 | endif |
David Turner | 046f7a0 | 2000-09-15 22:42:06 +0000 | [diff] [blame] | 129 | |
| 130 | BUILD_PROJECT := yes |
| 131 | include $(CONFIG_MK) |
| 132 | |
| 133 | endif # test check_platform |
| 134 | |
| 135 | # EOF |