mirror of
https://github.com/mirror/make.git
synced 2024-12-27 13:20:34 +08: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
@ -82,20 +82,25 @@ LINK_OUTPUT = -o $@
|
||||
|
||||
# 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)
|
||||
|
||||
CP = cp
|
||||
CP.cmd = $(CP) $< $@
|
||||
# $(call MKDIR.cmd,<dirlist>)
|
||||
MKDIR.cmd = mkdir -p $1
|
||||
|
||||
MKDIR = mkdir -p
|
||||
MKDIR.cmd = $(MKDIR) $@
|
||||
# $(call RM.cmd,<filelist>)
|
||||
RM.cmd = rm -f $1
|
||||
|
||||
RM = rm -f
|
||||
RM.cmd = $(RM) $(OBJECTS) $(PROG) $(BUILT_SOURCES)
|
||||
# $(call CP.cmd,<from>,<to>)
|
||||
CP.cmd = cp $1 $2
|
||||
|
||||
CLEANSPACE = $(call RM.cmd,$(OBJECTS) $(PROG) $(BUILT_SOURCES))
|
||||
|
||||
# Load overrides for the above variables.
|
||||
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)
|
||||
|
||||
$(PROG): $(OBJECTS)
|
||||
$(LINK.cmd)
|
||||
$(call LINK.cmd,$^)
|
||||
|
||||
$(OBJECTS): $(OUTDIR)%.$(OBJEXT): %.c
|
||||
$(COMPILE.cmd)
|
||||
$(call COMPILE.cmd,$<)
|
||||
|
||||
$(OBJECTS): | $(OBJDIRS) $(BUILT_SOURCES)
|
||||
|
||||
$(OBJDIRS):
|
||||
$(MKDIR.cmd)
|
||||
$(call MKDIR.cmd,$@)
|
||||
|
||||
check: $(PROG)
|
||||
check:
|
||||
$(CHECK.cmd)
|
||||
|
||||
clean:
|
||||
$(RM.cmd)
|
||||
$(CLEANSPACE)
|
||||
|
||||
$(filter %.h,$(BUILT_SOURCES)): %.h : %.in.h
|
||||
$(RM) $<
|
||||
$(CP.cmd)
|
||||
$(call RM.cmd,$@)
|
||||
$(call CP.cmd,$<,$@)
|
||||
|
||||
.PHONY: all check clean
|
||||
|
@ -77,6 +77,9 @@ Basic.mk: Basic.mk.template .dep_segment Makefile
|
||||
sed -e 's@^\([^ ]*\)\.o:@$$(OUTDIR)\1.$$(OBJEXT):@' \
|
||||
-e 's@\([^ ]*\.[ch]\)@$$(SRCDIR)/\1@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,$^) >>$@
|
||||
chmod a-w $@
|
||||
|
||||
|
@ -21,10 +21,9 @@
|
||||
CC = sc
|
||||
LD = $(CC) Link
|
||||
|
||||
RM = delete
|
||||
MKDIR = makedir
|
||||
CP = copy
|
||||
CP.cmd = $(CP) $< To $@
|
||||
MKDIR.cmd = makedir $1
|
||||
RM.cmd = delete $1
|
||||
CP.cmd = copy $1 To $2
|
||||
|
||||
CPPFLAGS =
|
||||
CFLAGS =
|
||||
@ -43,4 +42,4 @@ LDLIBS = Lib LIB:sc.lib LIB:amiga.lib
|
||||
LINK_OUTPUT = To $@
|
||||
|
||||
$(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
|
||||
EXEEXT = .exe
|
||||
|
||||
CP = copy
|
||||
MKDIR = create/dir
|
||||
RM = delete
|
||||
|
||||
e =
|
||||
s = $e $e
|
||||
c = ,
|
||||
@ -79,19 +75,23 @@ prog_SOURCES += $(ALLOCA) $(glob_SOURCES) $(vms_SOURCES)
|
||||
|
||||
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
|
||||
CHECK.cmd =
|
||||
|
||||
define RM.cmd
|
||||
MKDIR.cmd = create/dir $1
|
||||
RM.cmd = delete $1
|
||||
CP.cmd = copy $1 $2
|
||||
|
||||
define CLEANSPACE
|
||||
-purge [...]
|
||||
-$(RM) $(PROG);
|
||||
-$(RM) $(src)*.$(OBJEXT);
|
||||
-delete $(PROG);
|
||||
-delete $(src)*.$(OBJEXT);
|
||||
endef
|
||||
|
||||
|
||||
$(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 = 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)
|
||||
|
||||
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 \
|
||||
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)
|
||||
|
||||
MKDIR = cmd /c mkdir
|
||||
MKDIR.cmd = $(MKDIR) $(subst /,\\,$@)
|
||||
|
||||
RM = cmd /c del /F /Q
|
||||
RM.cmd = $(RM) $(subst /,\\,$(OBJECTS) $(PROG))
|
||||
|
||||
CP = cmd /c copy /Y
|
||||
CP.cmd = $(CP) $(subst /,\\,$< $@)
|
||||
MKDIR.cmd = cmd /c mkdir $(call P2W,$1)
|
||||
RM.cmd = cmd /c del /F /Q $(call P2W,$1)
|
||||
CP.cmd = cmd /c copy /Y $(call P2W,$1 $2)
|
||||
|
||||
CC = $($(TOOLCHAIN)_CC)
|
||||
LD = $($(TOOLCHAIN)_LD)
|
||||
@ -121,4 +119,4 @@ extra_LDFLAGS = $(call _CUSTOM,LDFLAGS)
|
||||
LDLIBS = $(call _CUSTOM,LDLIBS)
|
||||
|
||||
$(OUTDIR)src/config.h: $(SRCDIR)/src/config.h.W32
|
||||
$(CP.cmd)
|
||||
$(call CP.cmd,$<,$@)
|
||||
|
@ -23,22 +23,21 @@ EXEEXT = .exe
|
||||
|
||||
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)
|
||||
|
||||
BUILT_SOURCES += $(lib)fnmatch.h $(lib)glob.h
|
||||
BUILT_SOURCES += $(lib)alloca.h $(lib)fnmatch.h $(lib)glob.h
|
||||
|
||||
INCLUDEDIR = c:/djgpp/include
|
||||
LIBDIR = c:/djgpp/lib
|
||||
LOCALEDIR = c:/djgpp/share
|
||||
|
||||
MKDIR = command.com /c mkdir
|
||||
MKDIR.cmd = $(MKDIR) $(subst /,\\,$@)
|
||||
|
||||
RM = command.com /c del /F /Q
|
||||
RM.cmd = $(RM) $(subst /,\\,$(OBJECTS) $(PROG))
|
||||
|
||||
CP = command.com /c copy /Y
|
||||
CP.cmd = $(CP) $(subst /,\\,$< $@)
|
||||
MKDIR.cmd = command.com /c mkdir $(call P2W,$1)
|
||||
RM.cmd = command.com /c del /F /Q $(call P2W,$1)
|
||||
CP.cmd = command.com /c copy /Y $(call P2W,$1 $2)
|
||||
|
||||
$(OUTDIR)src/config.h: $(SRCDIR)/src/configh.dos
|
||||
$(CP.cmd)
|
||||
$(call CP.cmd,$<,$@)
|
||||
|
Loading…
Reference in New Issue
Block a user