1 # Watcom Makefile Patchwork 1.0
2 # Copyright (c) 2002, 2003 Simon Peter <dn.tlp@gmx.net>
4 # This (and only this) file is released under the terms and conditions
5 # of the Nullsoft license:
7 # This software is provided 'as-is', without any express or implied
8 # warranty. In no event will the authors be held liable for any damages
9 # arising from the use of this software.
11 # Permission is granted to anyone to use this software for any purpose,
12 # including commercial applications, and to alter it and redistribute it
13 # freely, subject to the following restrictions:
15 # 1. The origin of this software must not be misrepresented; you must not
16 # claim that you wrote the original software. If you use this software
17 # in a product, an acknowledgment in the product documentation would be
18 # appreciated but is not required.
19 # 2. Altered source versions must be plainly marked as such, and must not be
20 # misrepresented as being the original software.
21 # 3. This notice may not be removed or altered from any source distribution.
23 ### PRECONFIGURATION ###
36 MAKEFLAGS = /h $+$(__MAKEOPTS__)$-
52 installfile = install.txt
53 submakefile = Makefile.bt
54 configfile = config.mif
57 distlist = srcdist.lst
58 binarydistlist = bindist.lst
63 ### PRECONFIGURATION END ###
65 !include $(submakefile)
66 !include $(configfile)
68 ### LOCAL VARIABLES ###
69 # All subdirectory-recursive targets
70 Recursive_Targets = all.recursive clean.recursive install.recursive &
73 # Automatically distributed files
74 DIST += $(submakefile) $(installfile)
82 ### LOCAL VARIABLES END ###
86 $(CC) $(CFLAGS) $(CPPFLAGS) $[.
89 $(CXX) $(CXXFLAGS) $(CPPFLAGS) $[.
92 $(LIB) $(LIBFLAGS) $@ +$<
95 $(LD) $(LDFLAGS) N $@ F {$<} LIB {$(LIBRARIES)} SYS $(SYSTEM)
101 all: all.recursive $(OUTPUT) .symbolic
103 # Recurse through subdirectories.
104 $(Recursive_Targets): $(__MAKEFILES__) .symbolic
107 $(MAKE) /f ..\$[@ $(MAKEFLAGS) MAKEFLAGS=$(MAKEFLAGS) &
108 configfile=..\$(configfile) $*
110 for %d in ($(SUBDIRS)) do &
111 $(MAKE) /f $[@ $(MAKEFLAGS) MAKEFLAGS=$(MAKEFLAGS) &
112 configfile=$(configfile) CurrentSubdir=%d $@
119 clean: clean.recursive .symbolic
120 for %f in ($(OBJS) $(OUTPUT) $(distlist) $(binarydistlist)) do &
123 distclean: clean .symbolic
124 for %f in ($(configfile) $(distfile) $(binarydistfile)) do &
127 # Install the binaries $(bin_INST) into the directory $(bindir). Install the
128 # headers $(include_INST) into the directory $(includesubdir), which is
129 # located in the directory $(includedir). Install the libraries $(lib_INST)
130 # into the directory $(libdir). If the directories do not exist, they are
131 # created. If some of the binaries or libraries do not exist, they are also
133 install: install.recursive $(OUTPUT) .symbolic
135 if not exist $(includedir) mkdir $(includedir)
137 if not exist $(includedir)\$(includesubdir) &
138 mkdir $(includedir)\$(includesubdir)
139 for %f in ($(include_INST)) do copy %f $(includedir)\$(includesubdir)
141 for %f in ($(include_INST)) do copy %f $(includedir)
145 if not exist $(libdir) mkdir $(libdir)
146 for %f in ($(lib_INST)) do copy %f $(libdir)
149 if not exist $(bindir) mkdir $(bindir)
150 for %f in ($(bin_INST)) do copy %f $(bindir)
153 # Uninstalls previously installed files.
154 uninstall: uninstall.recursive .symbolic
157 for %f in ($(include_INST)) do del $(includedir)\$(includesubdir)\%f
158 rmdir $(includedir)\$(includesubdir)
160 for %f in ($(include_INST)) do del $(includedir)\%f
164 for %f in ($(lib_INST)) do del $(libdir)\%f
167 for %f in ($(bin_INST)) do del $(bindir)\%f
170 # Create a source distribution with filename $(distfile), containing the files
171 # $(DIST), using the program $(ZIP). Special options are in $(ZIPFLAGS).
173 $(distlist): $(__MAKEFILES__)
174 if exist $(distlist) del $(distlist)
175 echo $[@ > $(distlist)
176 for %f in ($(DIST)) do echo %f >> $(distlist)
178 $(distfile): $(distlist)
179 $(ZIP) $(ZIPFLAGS) $(distfile) @$(distlist)
181 dist: $(distfile) .symbolic
184 # Create a binary distribution with filename $(binarydistfile), containing
185 # the files $(BINARYDIST), using the program $(ZIP). Special options are in
186 # $(ZIPFLAGS). If the binaries do not exist, they are created.
187 !ifdef binarydistfile
188 $(binarydistlist): $(__MAKEFILES__)
189 if exist $(binarydistlist) del $(binarydistlist)
190 for %f in ($(BINARYDIST)) do echo %f >> $(binarydistlist)
192 $(binarydistfile): $(binarydistlist)
193 $(ZIP) $(ZIPFLAGS) $(binarydistfile) @$(binarydistlist)
195 binary-dist: all $(binarydistfile) .symbolic
198 ### MAIN SECTION END ###