| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473 |
- #
- # $Id$
- # This file is part of the Free Pascal run time library.
- # Copyright (c) 1996-98 by Michael van Canneyt
- #
- # Makefile for the Free Pascal Win32 Runtime Library
- #
- # See the file COPYING.FPC, included in this distribution,
- # for details about the copyright.
- #
- # This program is distributed in the hope that it will be useful,
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- #
- # Warning: this file contains TAB (#9) characters that are required for
- # make. Make sure you use an editor that does not replace TABs with
- # spaces, or the makefile won't work anymore after you save.
- #####################################################################
- # Configuration section
- #####################################################################
- # Use smartlinking ?
- ifndef SMARTLINK
- SMARTLINK=NO
- endif
- # Name of library ?
- # If this is set, all units will be put in the same library.
- # If it is empty (default), the units will be left in separate files.
- ifndef LIBNAME
- LIBNAME=
- #LIBNAME=fpc
- endif
- # Should the library be shared or static (only if LIBNAME is set).
- # Set this to 'shared' or 'static' to create a librrary
- # Setting this to shared will disable smart linking.
- ifndef LIBTYPE
- LIBTYPE=
- #LIBTYPE=static
- endif
- #####################################################################
- # Defaults
- #####################################################################
- # set target and cpu which are required
- override OS_TARGET=win32
- override CPU=i386
- # Where are the include files
- RTL=..
- CFG=$(RTL)/cfg
- INC=$(RTL)/inc
- PROCINC=$(RTL)/$(CPU)
- OBJPASDIR=$(RTL)/objpas
- # Where are the results placed
- TARGETDIR=.
- #####################################################################
- # Include default makefile
- #####################################################################
- include $(CFG)/makefile.cfg
- #####################################################################
- # System dependent
- #####################################################################
- # Define Win32 Units
- SYSTEMPPU=syswin32$(PPUEXT)
- LOADERS=wprt0 wdllprt0
- OBJECTS=strings windows \
- dos objects \
- objpas sysutils typinfo math \
- cpu mmx getopts heaptrc
- # Files used by windows.pp
- WINDOWS_FILES=base errors defines \
- struct ascfun ascdef \
- unifun unidef func
- WINDOWS_SOURCE_FILES=$(addsuffix .pp,$(WINDOWS_FILES))
- #####################################################################
- # Include system unit dependencies
- #####################################################################
- # Get the system independent include file names.
- # This will set the following variables :
- # SYSINCNAMES
- include $(INC)/makefile.inc
- SYSINCDEPS=$(addprefix $(INC)/,$(SYSINCNAMES))
- # Get the processor dependent include file names.
- # This will set the following variables :
- # CPUINCNAMES
- include $(PROCINC)/makefile.cpu
- SYSCPUDEPS=$(addprefix $(PROCINC)/,$(CPUINCNAMES))
- # Put system unit dependencies together.
- SYSDEPS=$(SYSINCDEPS) $(SYSCPUDEPS)
- #####################################################################
- # System independent Makefile
- #####################################################################
- # Add Prefix and Suffixes
- OBJLOADERS=$(addsuffix $(OEXT), $(LOADERS))
- PPUOBJECTS=$(addsuffix $(PPUEXT), $(OBJECTS))
- .PHONY : all install clean \
- libs libsclean \
- diffs diffclean \
- dllnames test
- all : $(OBJLOADERS) $(PPUOBJECTS)
- install : all
- $(MKDIR) $(UNITINSTALLDIR)
- $(INSTALL) *$(PPUEXT) *$(OEXT) $(UNITINSTALLDIR)
- clean :
- -$(DEL) *$(OEXT) *$(ASMEXT) *$(PPUEXT) log
- -$(DELTREE) *$(SMARTEXT)
- #####################################################################
- # Files
- #####################################################################
- #
- # Base Units (System, strings, os-dependent-base-unit)
- #
- ifneq ($(OS_SOURCE),win32)
- override AS=asw
- endif
- wprt0$(OEXT) : wprt0.as
- $(AS) -o wprt0$(OEXT) wprt0.as
- wdllprt0$(OEXT) : wdllprt0.as
- $(AS) -o wdllprt0$(OEXT) wdllprt0.as
- $(SYSTEMPPU) : syswin32.pp win32.inc $(SYSDEPS)
- $(COMPILER) -Us -Sg syswin32.pp $(REDIR)
- strings$(PPUEXT) : $(INC)/strings.pp $(INC)/stringsi.inc\
- $(PROCINC)/strings.inc $(PROCINC)/stringss.inc\
- $(SYSTEMPPU)
- $(COMPILER) $(INC)/strings.pp $(REDIR)
- #
- # Delphi Object Model
- #
- include $(OBJPASDIR)/makefile.op
- #
- # System Dependent Units
- #
- base$(PPUEXT) : base.pp $(SYSTEMPPU)
- $(COMPILER) base.pp $(REDIR)
- messages$(PPUEXT) : messages.pp $(SYSTEMPPU)
- $(COMPILER) messages.pp $(REDIR)
- defines$(PPUEXT) : defines.pp $(SYSTEMPPU)
- $(COMPILER) defines.pp $(REDIR)
- windows$(PPUEXT) : windows.pp $(WINDOWS_SOURCE_FILES) $(SYSTEMPPU)
- $(COMPILER) windows.pp $(REDIR)
- #
- # TP7 Compatible RTL Units
- #
- dos$(PPUEXT) : dos.pp $(INC)/filerec.inc $(INC)/textrec.inc $(SYSTEMPPU)
- $(COMPILER) dos.pp $(REDIR)
- objects$(PPUEXT) : $(INC)/objects.pp objinc.inc $(SYSTEMPPU)
- $(COMPILER) $(INC)/objects.pp $(REDIR)
- #
- # Other RTL Units
- #
- cpu$(PPUEXT) : $(PROCINC)/cpu.pp $(SYSTEMPPU)
- $(COMPILER) $(PROCINC)/cpu.pp $(REDIR)
- mmx$(PPUEXT) : $(PROCINC)/mmx.pp cpu$(PPUEXT) $(SYSTEMPPU)
- $(COMPILER) $(PROCINC)/mmx.pp $(REDIR)
- getopts$(PPUEXT) : $(INC)/getopts.pp $(SYSTEMPPU)
- $(COMPILER) $(INC)/getopts.pp $(REDIR)
- heaptrc$(PPUEXT) : $(INC)/heaptrc.pp $(SYSTEMPPU)
- $(COMPILER) $(INC)/heaptrc $(REDIR)
- #####################################################################
- # Libs
- #####################################################################
- staticlib:
- make clean
- make all SMARTLINK=YES LIBNAME=fpc LIBTYPE=static
- sharedlib:
- make clean
- make all
- $(PPUMOVE) -o fpc $(SHAREDLIBFILES)
- staticlibinstall: staticlib
- $(MKDIR) $(STATIC_LIBINSTALLDIR)
- $(MKDIR) $(STATIC_UNITINSTALLDIR)
- $(INSTALLEXE) libfpc$(STATICLIBEXT) $(STATIC_LIBINSTALLDIR)
- $(INSTALL) *$(PPUEXT) *$(OEXT) $(STATIC_UNITINSTALLDIR)
- sharedlibinstall: sharedlib
- $(MKDIR) $(SHARED_LIBINSTALLDIR)
- $(MKDIR) $(SHARED_UNITINSTALLDIR)
- $(INSTALLEXE) libfpc$(SHAREDLIBEXT) $(SHARED_LIBINSTALLDIR)
- $(INSTALL) *$(PPUEXT) *$(OEXT) $(SHARED_UNITINSTALLDIR)
- ldconfig
- libinstall: staticlibinstall
- libsclean : clean
- -$(DEL) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT)
- #####################################################################
- # windows.pp
- #####################################################################
- # Getting DLL names
- # not present in headers !!
- # first get the list of all exported function names
- # uses pedump
- # for system dll 's
- # gdi32.exp will contain all exported functions names of gdi32.dll
- WINDOWS_DIR:=c\:/windows
- %.exp : $(WINDOWS_DIR)/system/%.dll
- pedump $< > $*.tmp
- sed -n -e "s/Addr:\(.*\)Ord:\(.*\)Name: \(.*\)/@\3@/p" $*.tmp > $*.exp
- # -rm $*.tmp
- %.exd : $(WINDOWS_DIR)/system/%.drv
- pedump $< > $*.tmp
- sed -n -e "s/Addr:\(.*\)Ord:\(.*\)Name: \(.*\)/@\3@/p" $*.tmp > $*.exd
- # -rm $*.tmp
- # list of usefull dll's for windows.pp
- dllexps : gdi32.exp kernel32.exp advapi32.exp user32.exp mapi32.exp \
- comdlg32.exp shell32.exp mpr.exp comctl32.exp version.exp \
- opengl32.exp spoolss.exp winspool.exd
- # get a complete listing of all system dll's
- allexps : $(notdir $(patsubst %.dll,%.exp,$(wildcard $(WINDOWS_DIR)/system/*.dll)) \
- $(patsubst %.drv,%.exd,$(wildcard $(WINDOWS_DIR)/system/*.drv)))
- # extract the dllnames for which the real dll file is not
- # known yet
- # func.lst will contain all functions for which we still do
- # not know the origin DLL
- %.lst : %.pp
- @echo listing DLL function names of $*.pp
- sed -n -e "s/\(.*\)External_library name '\([^']*\)'\(.*\)/\2/p" $*.pp > $*.lst
- # get the DLL name from the listing in .exp files
- # of the current target
- define grepname
- $(filter %.dll %.drv ,$(subst .exd:,.drv ,$(subst .exp:,.dll ,$(shell grep @$*@ *.ex*))))
- endef
- # creating of a sed script that
- # will substitute all External_library
- # by the real name of the DLL if found in exports files
- # two stages
- # because you cannot set a variable inside the commands
- # Level 1 : set filename variable
- # Level 2 :
- %.sub : %.lst
- @echo getting DLL file name for $*
- -rm $*.sub
- @echo # Substitutions for $* >$*.sub
- # call make for all names in lst file
- # define LongList if there is an error
- # because the list is too long
- ifdef LongList
- $(foreach name,$(shell cat $*.lst),$(MAKE) subfile=$*.sub $(name).find ; )
- else
- $(MAKE) subfile=$*.sub $(addsuffix .find,$(shell cat $*.lst))
- endif
- # resubstitute unfound ones !!
- @echo s/external \'\' name \'\([^\']*\)\'/external\
- External_library name \'\1\'/ >>$*.sub
- @echo # End of substitutions for $* >>$*.sub
- # Change file according to function found in export
- # list remaining unfound functions in $*.mis
- %.npp : %.sub
- sed -f $*.sub $*.pp > $*.npp
- sed -n -e "s/\(.*\)External_library name \'\([^\']*\)\'\(.*\)/\2/p" $*.npp > $*.mis
- %.find :
- @echo $* is in $(grepname)
- ifdef subfile
- @echo s/external External_library name \'$*\'/external\
- \'$(filter %.dll %.drv ,$(subst .exd:,.drv ,$(subst .exp:,.dll ,$(shell grep @$*@ *.ex*))))\'\
- name \'$*\'/ >>$(subfile)
- else
- @echo external \
- \'$(filter %.dll %.drv ,$(subst .exd:,.drv ,$(subst .exp:,.dll ,$(shell grep @$*@ *.ex*))))\'\
- name $*
- endif
- GNUWIN32LIBDIR=./
- %.find2 :
- @echo s/In archive \(.*\)/\1/p >find.sed
- @echo s/\(.*\)___imp_$*@\(.*\)/found: $*/p >>find.sed
- ifdef subfile
- sed -n -f find.sed alllibs.sym >> $(subfile)
- else
- sed -n -f find.sed alllibs.sym > $*.res
- endif
- missing : $(GNUWIN32LIBDIR)alllibs.sym $(addsuffix .lst,$(WINDOWS_FILES))
- -rm missing
- $(MAKE) subfile=missing $(addsuffix .find2,$(shell cat *.lst))
- substmissing : missing
- dtou missing
- @echo N > test.sed
- @echo s/lib\(.*\)\.a:\nfound: \(.*\)/\1.dll : \2/p >> test.sed
- @echo D >> test.sed
- sed -n -f test.sed missing > missing.tmp
- sed -e "s#\(.*\) : \(.*\)#s/external External_library name \'\2\'/external \'\1\' name \'\2\'/#" missing.tmp > missing.sub
- dllnames:
- $(MAKE) $(addsuffix .lst,$(WINDOWS_FILES))
- test:
- @echo namelist of $(filename) is "$(namelist)"
- # automatic conversion from ascfun.pp to ascdef.pp
- # and unifun.pp to unidef.pp
- # only if sed is present
- ifdef SED
- ascdef.pp : ascfun.pp ascdef.sed
- sed -f ascdef.sed ascfun.pp > ascdef.pp
- unidef.pp : unifun.pp unidef.sed
- sed -f unidef.sed unifun.pp > unidef.pp
- endif
- #####################################################################
- # Default targets
- #####################################################################
- include $(CFG)/makefile.def
- #
- # $Log$
- # Revision 1.19 1999-02-25 09:59:03 michael
- # + Fixed type in strings target
- #
- # Revision 1.18 1999/02/25 07:39:19 michael
- # * Joined strings and sysutils
- #
- # Revision 1.17 1999/01/15 11:47:19 peter
- # + added math unit to objects
- #
- # Revision 1.16 1999/01/04 11:57:45 peter
- # * clean doesn't clean objpasdir anymore
- #
- # Revision 1.15 1998/12/21 13:07:07 peter
- # * use -FE
- #
- # Revision 1.14 1998/11/30 13:13:40 pierre
- # * needs asw to link correctly wprt0 or wdllprt0 file
- #
- # Revision 1.13 1998/11/30 09:16:57 pierre
- # + added the changes from Pavel Ozerski after several modifications
- # to be able to create DLLs
- #
- # Revision 1.12 1998/11/24 19:52:10 jonas
- # + added warning about TABs
- #
- # Revision 1.11 1998/11/18 09:28:07 pierre
- # + added objects unit
- #
- # Revision 1.10 1998/10/14 12:49:42 peter
- # * fixed dos dependency
- #
- # Revision 1.9 1998/10/12 08:36:32 pierre
- # * wrong 'objpas' target in all removed
- #
- # Revision 1.8 1998/10/11 13:45:03 michael
- # + Added disk.inc to sysutils dependencies
- #
- # Revision 1.7 1998/10/11 12:21:46 michael
- # + Further sysutils implementations.
- #
- # Revision 1.6 1998/10/06 22:10:32 peter
- # + heaptrc
- #
- # Revision 1.5 1998/10/02 09:26:05 peter
- # * fixed rtl path
- #
- # Revision 1.4 1998/09/16 16:47:35 peter
- # * merged fixes
- #
- # Revision 1.1.2.2 1998/09/16 16:17:55 peter
- # * updates to install with go32,win32
- #
- # Revision 1.3 1998/09/15 12:09:13 peter
- # * merged updates
- #
- # Revision 1.2 1998/09/11 15:09:48 michael
- # fixed colon problem
- #
- # Revision 1.1.2.1 1998/09/15 12:02:06 peter
- # * updates to get objpas using its own makefile
- #
- # Revision 1.1 1998/09/10 14:15:55 peter
- # - renamed makefile to Makefile
- #
- # Revision 1.13 1998/09/07 18:31:54 peter
- # * fixed $smartlibext -> $staticlibext to fix a 'rm *' :(
- #
- # Revision 1.12 1998/09/04 17:17:36 pierre
- # + all unknown function ifdef with
- # conditionnal unknown_functions
- # testwin works now, but windowcreate still fails !!
- #
- # Revision 1.11 1998/09/04 12:33:12 pierre
- # + added SED testing for ascdef.pp and unidef.pp
- # * func.pp ready
- # still some functions missing (commented out for now)
- #
- # Revision 1.10 1998/09/03 18:17:35 pierre
- # * small improvements in number of found functions
- # all remaining are in func.pp
- #
- # Revision 1.9 1998/09/03 17:14:54 pierre
- # * most functions found in main DLL's
- # still some missing
- # use 'make dllnames' to get missing names
- #
- # Revision 1.7 1998/08/21 15:17:01 peter
- # * win32 compiles a bit better, no growheap crash
- #
- #
|