mirror of
https://git.savannah.gnu.org/git/make.git
synced 2025-01-27 09:43:41 +00:00
Enhance the Basic.mk environment to work with Gnulib
* maintMakefile: Omit generated headers from Basic.mk prerequisites. * Basic.mk.template: Rework commands to use with $(call ...) macros. * mk/Amiga.mk: Ditto. * mk/VMS.mk: Ditto. * mk/Windows32.mk: Ditto, plus P2W to convert POSIX to Windows paths. * mk/msdosdjgpp.mk: Ditto.
This commit is contained in:
parent
0ce880e5ee
commit
23554ee658
6 changed files with 55 additions and 51 deletions
|
@ -82,20 +82,25 @@ LINK_OUTPUT = -o $@
|
||||||
|
|
||||||
# Command lines
|
# Command lines
|
||||||
|
|
||||||
COMPILE.cmd = $(CC) $(extra_CFLAGS) $(CFLAGS) $(extra_CPPFLAGS) $(CPPFLAGS) $(TARGET_ARCH) $(OUTPUT_OPTION) $(C_SOURCE) $<
|
# $(call COMPILE.cmd,<src>,<tgt>)
|
||||||
|
COMPILE.cmd = $(CC) $(extra_CFLAGS) $(CFLAGS) $(extra_CPPFLAGS) $(CPPFLAGS) $(TARGET_ARCH) $(OUTPUT_OPTION) $(C_SOURCE) $1
|
||||||
|
|
||||||
LINK.cmd = $(LD) $(extra_LDFLAGS) $(LDFLAGS) $(TARGET_ARCH) $^ $(LDLIBS) $(LINK_OUTPUT)
|
# $(call LINK.cmd,<objectlist>)
|
||||||
|
LINK.cmd = $(LD) $(extra_LDFLAGS) $(LDFLAGS) $(TARGET_ARCH) $1 $(LDLIBS) $(LINK_OUTPUT)
|
||||||
|
|
||||||
|
# $(CHECK.cmd)
|
||||||
CHECK.cmd = cd $(SRCDIR)/tests && ./run_make_tests -make $(shell cd $(<D) && pwd)/$(<F)
|
CHECK.cmd = cd $(SRCDIR)/tests && ./run_make_tests -make $(shell cd $(<D) && pwd)/$(<F)
|
||||||
|
|
||||||
CP = cp
|
# $(call MKDIR.cmd,<dirlist>)
|
||||||
CP.cmd = $(CP) $< $@
|
MKDIR.cmd = mkdir -p $1
|
||||||
|
|
||||||
MKDIR = mkdir -p
|
# $(call RM.cmd,<filelist>)
|
||||||
MKDIR.cmd = $(MKDIR) $@
|
RM.cmd = rm -f $1
|
||||||
|
|
||||||
RM = rm -f
|
# $(call CP.cmd,<from>,<to>)
|
||||||
RM.cmd = $(RM) $(OBJECTS) $(PROG) $(BUILT_SOURCES)
|
CP.cmd = cp $1 $2
|
||||||
|
|
||||||
|
CLEANSPACE = $(call RM.cmd,$(OBJECTS) $(PROG) $(BUILT_SOURCES))
|
||||||
|
|
||||||
# Load overrides for the above variables.
|
# Load overrides for the above variables.
|
||||||
include $(firstword $(wildcard $(SRCDIR)/mk/$(lastword $(subst -, ,$(MAKE_HOST)).mk) $(OUTDIR)mk/Posix.mk $(SRCDIR)/mk/Posix.mk))
|
include $(firstword $(wildcard $(SRCDIR)/mk/$(lastword $(subst -, ,$(MAKE_HOST)).mk) $(OUTDIR)mk/Posix.mk $(SRCDIR)/mk/Posix.mk))
|
||||||
|
@ -107,24 +112,24 @@ VPATH = $(SRCDIR)
|
||||||
all: $(PROG)
|
all: $(PROG)
|
||||||
|
|
||||||
$(PROG): $(OBJECTS)
|
$(PROG): $(OBJECTS)
|
||||||
$(LINK.cmd)
|
$(call LINK.cmd,$^)
|
||||||
|
|
||||||
$(OBJECTS): $(OUTDIR)%.$(OBJEXT): %.c
|
$(OBJECTS): $(OUTDIR)%.$(OBJEXT): %.c
|
||||||
$(COMPILE.cmd)
|
$(call COMPILE.cmd,$<)
|
||||||
|
|
||||||
$(OBJECTS): | $(OBJDIRS) $(BUILT_SOURCES)
|
$(OBJECTS): | $(OBJDIRS) $(BUILT_SOURCES)
|
||||||
|
|
||||||
$(OBJDIRS):
|
$(OBJDIRS):
|
||||||
$(MKDIR.cmd)
|
$(call MKDIR.cmd,$@)
|
||||||
|
|
||||||
check: $(PROG)
|
check:
|
||||||
$(CHECK.cmd)
|
$(CHECK.cmd)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(RM.cmd)
|
$(CLEANSPACE)
|
||||||
|
|
||||||
$(filter %.h,$(BUILT_SOURCES)): %.h : %.in.h
|
$(filter %.h,$(BUILT_SOURCES)): %.h : %.in.h
|
||||||
$(RM) $<
|
$(call RM.cmd,$@)
|
||||||
$(CP.cmd)
|
$(call CP.cmd,$<,$@)
|
||||||
|
|
||||||
.PHONY: all check clean
|
.PHONY: all check clean
|
||||||
|
|
|
@ -77,6 +77,9 @@ Basic.mk: Basic.mk.template .dep_segment Makefile
|
||||||
sed -e 's@^\([^ ]*\)\.o:@$$(OUTDIR)\1.$$(OBJEXT):@' \
|
sed -e 's@^\([^ ]*\)\.o:@$$(OUTDIR)\1.$$(OBJEXT):@' \
|
||||||
-e 's@\([^ ]*\.[ch]\)@$$(SRCDIR)/\1@g' \
|
-e 's@\([^ ]*\.[ch]\)@$$(SRCDIR)/\1@g' \
|
||||||
-e 's@$$(SRCDIR)/src/config.h@$$(OUTDIR)src/config.h@g' \
|
-e 's@$$(SRCDIR)/src/config.h@$$(OUTDIR)src/config.h@g' \
|
||||||
|
-e 's@$$(SRCDIR)/lib/stdlib.h@@g' \
|
||||||
|
-e 's@$$(SRCDIR)/lib/sys/types.h@@g' \
|
||||||
|
-e 's@$$(SRCDIR)/lib/unistd.h@@g' \
|
||||||
$(word 2,$^) >>$@
|
$(word 2,$^) >>$@
|
||||||
chmod a-w $@
|
chmod a-w $@
|
||||||
|
|
||||||
|
|
|
@ -21,10 +21,9 @@
|
||||||
CC = sc
|
CC = sc
|
||||||
LD = $(CC) Link
|
LD = $(CC) Link
|
||||||
|
|
||||||
RM = delete
|
MKDIR.cmd = makedir $1
|
||||||
MKDIR = makedir
|
RM.cmd = delete $1
|
||||||
CP = copy
|
CP.cmd = copy $1 To $2
|
||||||
CP.cmd = $(CP) $< To $@
|
|
||||||
|
|
||||||
CPPFLAGS =
|
CPPFLAGS =
|
||||||
CFLAGS =
|
CFLAGS =
|
||||||
|
@ -43,4 +42,4 @@ LDLIBS = Lib LIB:sc.lib LIB:amiga.lib
|
||||||
LINK_OUTPUT = To $@
|
LINK_OUTPUT = To $@
|
||||||
|
|
||||||
$(OUTDIR)src/config.h: $(SRCDIR)/src/config.ami
|
$(OUTDIR)src/config.h: $(SRCDIR)/src/config.ami
|
||||||
$(CP.cmd)
|
$(call CP.cmd,$<,$@)
|
||||||
|
|
20
mk/VMS.mk
20
mk/VMS.mk
|
@ -25,10 +25,6 @@ SRCDIR = []
|
||||||
OBJEXT = .obj
|
OBJEXT = .obj
|
||||||
EXEEXT = .exe
|
EXEEXT = .exe
|
||||||
|
|
||||||
CP = copy
|
|
||||||
MKDIR = create/dir
|
|
||||||
RM = delete
|
|
||||||
|
|
||||||
e =
|
e =
|
||||||
s = $e $e
|
s = $e $e
|
||||||
c = ,
|
c = ,
|
||||||
|
@ -79,19 +75,23 @@ prog_SOURCES += $(ALLOCA) $(glob_SOURCES) $(vms_SOURCES)
|
||||||
|
|
||||||
BUILT_SOURCES += $(lib)fnmatch.h $(lib)glob.h
|
BUILT_SOURCES += $(lib)fnmatch.h $(lib)glob.h
|
||||||
|
|
||||||
COMPILE.cmd = $(CC) $(extra_CFLAGS)$(CFLAGS)/obj=$@ $(extra_CPPFLAGS)$(CPPFLAGS) $<
|
COMPILE.cmd = $(CC) $(extra_CFLAGS)$(CFLAGS)/obj=$@ $(extra_CPPFLAGS)$(CPPFLAGS) $1
|
||||||
|
|
||||||
LINK.cmd = $(LD)$(extra_LDFLAGS)$(LDFLAGS)/exe=$@ $(subst $s,$c,$^)$(LDLIBS)
|
LINK.cmd = $(LD)$(extra_LDFLAGS)$(LDFLAGS)/exe=$@ $(subst $s,$c,$1)$(LDLIBS)
|
||||||
|
|
||||||
# Don't know how to do this
|
# Don't know how to do this
|
||||||
CHECK.cmd =
|
CHECK.cmd =
|
||||||
|
|
||||||
define RM.cmd
|
MKDIR.cmd = create/dir $1
|
||||||
|
RM.cmd = delete $1
|
||||||
|
CP.cmd = copy $1 $2
|
||||||
|
|
||||||
|
define CLEANSPACE
|
||||||
-purge [...]
|
-purge [...]
|
||||||
-$(RM) $(PROG);
|
-delete $(PROG);
|
||||||
-$(RM) $(src)*.$(OBJEXT);
|
-delete $(src)*.$(OBJEXT);
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
|
||||||
$(OUTDIR)$(src)config.h: $(SRCDIR)$(src)config.h.W32
|
$(OUTDIR)$(src)config.h: $(SRCDIR)$(src)config.h.W32
|
||||||
$(CP.cmd)
|
$(call CP.cmd,$<,$@)
|
||||||
|
|
|
@ -24,10 +24,13 @@ TARGET_TYPE = release
|
||||||
# TOOLCHAIN can be either "msvc" or "gcc"
|
# TOOLCHAIN can be either "msvc" or "gcc"
|
||||||
TOOLCHAIN = msvc
|
TOOLCHAIN = msvc
|
||||||
|
|
||||||
|
# Translate a POSIX path into a Windows path. Don't bother with drives.
|
||||||
|
# Used only inside recipes, with DOS/CMD tools that require it.
|
||||||
|
P2W = $(subst /,\,$1)
|
||||||
|
|
||||||
prog_SOURCES += $(loadavg_SOURCES) $(glob_SOURCES) $(w32_SOURCES)
|
prog_SOURCES += $(loadavg_SOURCES) $(glob_SOURCES) $(w32_SOURCES)
|
||||||
|
|
||||||
BUILT_SOURCES += $(lib)fnmatch.h $(lib)glob.h
|
BUILT_SOURCES += $(lib)alloca.h $(lib)fnmatch.h $(lib)glob.h
|
||||||
|
|
||||||
w32_LIBS = kernel32 user32 gdi32 winspool comdlg32 advapi32 shell32 ole32 \
|
w32_LIBS = kernel32 user32 gdi32 winspool comdlg32 advapi32 shell32 ole32 \
|
||||||
oleaut32 uuid odbc32 odbccp32
|
oleaut32 uuid odbc32 odbccp32
|
||||||
|
@ -84,18 +87,13 @@ release_gcc_CFLAGS = -O2
|
||||||
|
|
||||||
# ---
|
# ---
|
||||||
|
|
||||||
LINK.cmd = $(LD) $(extra_LDFLAGS) $(LDFLAGS) $(TARGET_ARCH) $^ $(LDLIBS) $(LINK_OUTPUT)
|
LINK.cmd = $(LD) $(extra_LDFLAGS) $(LDFLAGS) $(TARGET_ARCH) $1 $(LDLIBS) $(LINK_OUTPUT)
|
||||||
|
|
||||||
CHECK.cmd = cmd /c cd tests \& .\run_make_tests.bat -make ../$(PROG)
|
CHECK.cmd = cmd /c cd tests \& .\run_make_tests.bat -make ../$(PROG)
|
||||||
|
|
||||||
MKDIR = cmd /c mkdir
|
MKDIR.cmd = cmd /c mkdir $(call P2W,$1)
|
||||||
MKDIR.cmd = $(MKDIR) $(subst /,\\,$@)
|
RM.cmd = cmd /c del /F /Q $(call P2W,$1)
|
||||||
|
CP.cmd = cmd /c copy /Y $(call P2W,$1 $2)
|
||||||
RM = cmd /c del /F /Q
|
|
||||||
RM.cmd = $(RM) $(subst /,\\,$(OBJECTS) $(PROG))
|
|
||||||
|
|
||||||
CP = cmd /c copy /Y
|
|
||||||
CP.cmd = $(CP) $(subst /,\\,$< $@)
|
|
||||||
|
|
||||||
CC = $($(TOOLCHAIN)_CC)
|
CC = $($(TOOLCHAIN)_CC)
|
||||||
LD = $($(TOOLCHAIN)_LD)
|
LD = $($(TOOLCHAIN)_LD)
|
||||||
|
@ -121,4 +119,4 @@ extra_LDFLAGS = $(call _CUSTOM,LDFLAGS)
|
||||||
LDLIBS = $(call _CUSTOM,LDLIBS)
|
LDLIBS = $(call _CUSTOM,LDLIBS)
|
||||||
|
|
||||||
$(OUTDIR)src/config.h: $(SRCDIR)/src/config.h.W32
|
$(OUTDIR)src/config.h: $(SRCDIR)/src/config.h.W32
|
||||||
$(CP.cmd)
|
$(call CP.cmd,$<,$@)
|
||||||
|
|
|
@ -23,22 +23,21 @@ EXEEXT = .exe
|
||||||
|
|
||||||
CC = gcc
|
CC = gcc
|
||||||
|
|
||||||
|
# Translate a POSIX path into a Windows path. Don't bother with drives.
|
||||||
|
# Used only inside recipes, with DOS/CMD tools that require it.
|
||||||
|
P2W = $(subst /,\,$1)
|
||||||
|
|
||||||
prog_SOURCES += $(loadavg_SOURCES) $(glob_SOURCES)
|
prog_SOURCES += $(loadavg_SOURCES) $(glob_SOURCES)
|
||||||
|
|
||||||
BUILT_SOURCES += $(lib)fnmatch.h $(lib)glob.h
|
BUILT_SOURCES += $(lib)alloca.h $(lib)fnmatch.h $(lib)glob.h
|
||||||
|
|
||||||
INCLUDEDIR = c:/djgpp/include
|
INCLUDEDIR = c:/djgpp/include
|
||||||
LIBDIR = c:/djgpp/lib
|
LIBDIR = c:/djgpp/lib
|
||||||
LOCALEDIR = c:/djgpp/share
|
LOCALEDIR = c:/djgpp/share
|
||||||
|
|
||||||
MKDIR = command.com /c mkdir
|
MKDIR.cmd = command.com /c mkdir $(call P2W,$1)
|
||||||
MKDIR.cmd = $(MKDIR) $(subst /,\\,$@)
|
RM.cmd = command.com /c del /F /Q $(call P2W,$1)
|
||||||
|
CP.cmd = command.com /c copy /Y $(call P2W,$1 $2)
|
||||||
RM = command.com /c del /F /Q
|
|
||||||
RM.cmd = $(RM) $(subst /,\\,$(OBJECTS) $(PROG))
|
|
||||||
|
|
||||||
CP = command.com /c copy /Y
|
|
||||||
CP.cmd = $(CP) $(subst /,\\,$< $@)
|
|
||||||
|
|
||||||
$(OUTDIR)src/config.h: $(SRCDIR)/src/configh.dos
|
$(OUTDIR)src/config.h: $(SRCDIR)/src/configh.dos
|
||||||
$(CP.cmd)
|
$(call CP.cmd,$<,$@)
|
||||||
|
|
Loading…
Reference in a new issue