1#
2# Obtain the global build environment
3#
4
5include $(AP_WORK)/build/NWGNUenvironment.inc
6
7#
8# Define base targets and rules
9#
10
11TARGETS = libs nlms install clobber_libs clobber_nlms clean installdev
12
13.PHONY : $(TARGETS) default all help $(NO_LICENSE_FILE)
14
15# Here is where we will use the NO_LICENSE_FILE variable to see if we need to
16# restart the make with it defined
17
18ifdef NO_LICENSE_FILE
19
20default: NO_LICENSE_FILE
21
22all: NO_LICENSE_FILE
23
24install :: NO_LICENSE_FILE
25
26installdev :: NO_LICENSE_FILE
27
28NO_LICENSE_FILE :
29	$(MAKE) $(MAKECMDGOALS) -f NWGNUmakefile RELEASE=$(RELEASE) DEST="$(INSTALL)" LM_LICENSE_FILE="$(METROWERKS)/license.dat"
30
31else # LM_LICENSE_FILE must be defined so use the real targets
32
33default: $(SUBDIRS) libs nlms
34
35all: $(SUBDIRS) libs nlms install
36
37$(TARGETS) :: $(SUBDIRS)
38
39install :: nlms $(INSTDIRS)
40
41installdev :: $(INSTDEVDIRS)
42
43$(INSTDIRS) ::
44	$(call MKDIR,$@)
45
46$(INSTDEVDIRS) ::
47	$(call MKDIR,$@)
48
49endif #NO_LICENSE_FILE check
50
51help :
52	@echo $(DL)targets for RELEASE=$(RELEASE):$(DL)
53	@echo $(DL)(default) . . . . libs nlms$(DL)
54	@echo $(DL)all . . . . . . . does everything (libs nlms install)$(DL)
55	@echo $(DL)libs. . . . . . . builds all libs$(DL)
56	@echo $(DL)nlms. . . . . . . builds all nlms$(DL)
57	@echo $(DL)install . . . . . builds libs and nlms and copies install files to$(DL)
58	@echo $(DL)                  "$(INSTALL)"$(DL)
59	@echo $(DL)installdev. . . . copies headers and files needed for development to$(DL)
60	@echo $(DL)                  "$(INSTALL)"$(DL)
61	@echo $(DL)clean . . . . . . deletes $(OBJDIR) dirs, *.err, and *.map$(DL)
62	@echo $(DL)clobber_all . . . deletes all possible output from the make$(DL)
63	@echo $(DL)clobber_install . deletes all files in $(INSTALL)$(DL)
64	@$(ECHONL)
65	@echo $(DL)Multiple targets can be used on a single nmake command line -$(DL)
66	@echo $(DL)(i.e. $(MAKE) clean all)$(DL)
67	@$(ECHONL)
68	@echo $(DL)You can also specify RELEASE=debug, RELEASE=noopt, or RELEASE=optimized$(DL)
69	@echo $(DL)The default is RELEASE=optimized$(DL)
70
71clobber_all :: clean clobber_install clobber_prebuild
72
73clobber_install ::
74	$(call RMDIR,$(INSTALL))
75
76clobber_prebuild ::
77	$(call RMDIR,$(PREBUILD_INST))
78
79#
80# build recursive targets
81#
82
83$(SUBDIRS) : FORCE
84ifneq "$(MAKECMDGOALS)" "clean"
85ifneq "$(findstring clobber_,$(MAKECMDGOALS))" "clobber_"
86	@$(ECHONL)
87	@echo $(DL)Building $(CURDIR)/$@$(DL)
88endif
89endif
90	$(MAKE) -C $@ $(MAKECMDGOALS) -f NWGNUmakefile RELEASE=$(RELEASE) DEST="$(INSTALL)" LM_LICENSE_FILE="$(LM_LICENSE_FILE)"
91	@$(ECHONL)
92
93FORCE:
94
95#
96# Standard targets
97#
98
99clean :: $(SUBDIRS)
100	@echo $(DL)Cleaning up $(CURDIR)$(DL)
101	$(call RMDIR,$(OBJDIR))
102	$(call DEL,*.err)
103	$(call DEL,*.map)
104	$(call DEL,*.tmp)
105#	$(call DEL,*.d)
106
107$(OBJDIR) ::
108	$(call MKDIR,$@)
109
110