# $Id: odin32.post.vac3.mk,v 1.32 2005-03-06 10:35:58 sao2l02 Exp $ # # Odin32 API # # Common dll makefile rules (must be included at the last line of the makefile) # # If ORGTARGET is defined it is used to generate the importlibrary. # # Define NOTEXPDEF to remove the $(TARGET).lib and $(TARGET)exp.def rules. # Define EXETARGET to make an executable. (This also applies to odin32.mk.) # Define LIBTARGET to make an internal library. # Define LOCALCLEAN if only the local directory is to be clean. # Define CLEAN2 to invoke a second clean rule named 'clean2'. # Define NOCLEAN to exclude the clean rule. (Remember to make your own!) # # New style: (!defined OLD_STYLE) # Define NO_ALL_RULE to not make default all rule. # Define NO_LIB_RULE to not make default lib rule. # Define NO_MAIN_RULE to not make default main target rule. # Define NO_LNKFILE_RULE to not make default link-file rule. # Define NO_DEP_RULE to not make dependencies rule. # Define NO_CLEAN_RULE to not make clean rule (same as NOCLEAN - use this!). # Define NO_INTERNAL_LIBS to not include libs rule for subdirectories. # Define NO_MAIN_BIN_COPY to not copy the target and sym file to the main # binary directory. It is only copied to the compiler specific directory. # Main bin is /bin. Compiler specific bin is /bin/debug, /bin/debug.vac36, etc. # Define ADDITIONAL_DEP to add dependencies rules. # Define ADDITIONAL_ALL to add targets all should depend on. # # Define MAKEFILE if the name of the makefile isn't "makefile". # Define DEFFILE to specify another file than $(TARGET).def or $(ORGTARGET).def. # Define this if your .exe file have a .def file. # Define OS2RES as the names of the OS/2 .res file to create and link # with the target .dll or .exe. # Define LIBS as a list of all the libraries to link # with the target .dll or .exe. # Define SUBDIRS when you have subdirectories which should be made. # dep and lib supports this fully. The rule libs are added, since we assume you # makes internal libraries in the subdirectories. The libs rule is one of the # dependencies of the main target. # # Sanity check !ifndef ODIN32_LIB ! error "ODIN32_LIB is not defined" !endif ODIN32_LIB !ifndef ODIN32_TOOLS ! error "ODIN32_TOOLS is not defined" !endif ODIN32_TOOLS !ifndef TARGET_EXTENSION ! ifdef LIBTARGET TARGET_EXTENSION=lib ! else ! ifdef EXETARGET TARGET_EXTENSION=exe ! else TARGET_EXTENSION=dll ! endif ! endif !endif !ifndef OLD_STYLE # Set default MAKEFILE if needed !ifndef MAKEFILE MAKEFILE = makefile !endif # Set default ORGTARGET if needed. !ifndef ORGTARGET ORGTARGET=$(TARGET) !endif # # Set the Wrapper definition for DEBUG # !ifdef ODIN32_DBGWRAP ! if "$(DEBUG)" == "1" DEFFILE = $(ORGTARGET)dbg.def ORGDEFFILE = $(ORGTARGET).def OBJS = $(OBJS) $(OBJDIR)\dbgwrap.obj ! endif !endif # Set default DEFFILE if needed. (Required for both DLLs and EXEs!) !ifndef DEFFILE DEFFILE = $(ORGTARGET).def !endif !ifndef ORGDEFFILE ORGDEFFILE = $(ORGTARGET).def !endif # Set INTLIBS (interal) if SUBDIRS is defined and NO_INTERNAL_LIBS is undefined. !ifdef SUBDIRS ! ifndef NO_INTERNAL_LIBS ! ifndef LIBTARGET INTLIBS = libs ! else INTLIBS = libs_sub ! endif ! endif !endif !ifndef LIBTARGET !ifndef EXETARGET ############################################################################### # DLL Target ############################################################################### # # Dll: All rule - build objs, target dll, copies target to bin and makes libs. # !ifndef NO_ALL_RULE all: $(OBJDIR) \ $(INTLIBS) \ $(OBJDIR)\$(TARGET).$(TARGET_EXTENSION) \ $(OBJDIR)\$(TARGET).sym \ $(ODIN32_BIN)\$(TARGET).$(TARGET_EXTENSION) \ $(ODIN32_BIN)\$(TARGET).sym \ lib \ $(ADDITIONAL_ALL) !endif # # Dll: Lib rule - build importlibrary (and evt. other libs) # !ifndef NO_LIB_RULE lib: $(OBJDIR) \ $(OBJDIR)\$(ORGTARGET).lib \ $(ODIN32_LIB)\$(ORGTARGET).lib !endif # # Dll: Main target rule - builds the target dll. # !ifndef NO_MAIN_RULE $(OBJDIR)\$(TARGET).$(TARGET_EXTENSION): $(LIBS) $(OBJS) $(OS2RES) $(DEFFILE) $(OBJDIR)\bldlevel.$(ORGDEFFILE) $(OBJDIR)\$(TARGET).lrf $(CMDQD_WAIT) !if "$(CCENV)" != "EMX" -4 \ !endif $(LD2) $(LD2FLAGS) @$(OBJDIR)\$(TARGET).lrf !ifdef OS2RES $(OS2RC) $(OS2RCLFLAGS) $(OS2RES) $@ !endif !if !defined(DEBUG) && !defined(NO_LXLITE) # remove all EAs from the file to prevent errors running LXLITE on # a LAN server mounted JFS volume eautil $@ nul /s $(LXLITE) $@ !endif !endif # # Dll: Linker file - creates the parameter file passed on to the linker. # !ifndef NO_LNKFILE_RULE $(OBJDIR)\$(TARGET).lrf: $(MAKEFILE) $(ODIN32_INCLUDE)\odin32.post.vac3.mk !if "$(CCENV)" != "EMX" @echo Creating file <<$@ /OUT:$(OBJDIR)\$(TARGET).$(TARGET_EXTENSION) /MAP:$(OBJDIR)\$(TARGET).map $(OBJS: =^ ) $(OBJ_PROFILE) $(LIB_PROFILE) $(LIBS: =^ ) $(OBJDIR)\bldlevel.$(ORGDEFFILE) <exp.def or the <>.def file. # !ifndef LIBTARGET !ifndef NOTEXPDEF $(OBJDIR)\$(ORGTARGET).lib: $(OBJDIR)\$(ORGTARGET)exp.def $(IMPLIB) $(IMPLIBFLAGS) $@ $** !else $(OBJDIR)\$(TARGET).lib: $(DEFFILE) $(IMPLIB) $(IMPLIBFLAGS) $@ $** !endif !endif # # Common: Make the <>exp.def file. # !ifndef LIBTARGET !ifndef NOTEXPDEF $(OBJDIR)\$(ORGTARGET)exp.def: $(ORGDEFFILE) $(IMPDEF) $(IMPDEF_FLAGS) $** $@ !endif !endif # # Common: Make .def-file with buildlevel info. # $(OBJDIR)\bldlevel.$(ORGDEFFILE): $(DEFFILE) $(BLDLEVELINF) $(DEFFILE) $@ -R"$(DEFFILE)" \ -V"#define=ODIN32_VERSION,$(ODIN32_INCLUDE)\odinbuild.h" \ -M"#define=ODIN32_BUILD_NR,$(ODIN32_INCLUDE)\odinbuild.h" !ifndef NOPEHDR # # Common: Make the pe_$(ORGTARGET).obj # $(OBJDIR)\pe_$(ORGTARGET).obj: $(DEFFILE) $(PEBUILD) $(PEBUILD) $(ORGTARGET) $(DEFFILE) > $(@R).asm $(AS) $(ASFLAGS) -Fdo:$(OBJDIR) $(@R).asm !endif # # Common: Create the object directory. # $(OBJDIR): @if not exist $(OBJDIR) $(CREATEPATH) $(OBJDIR) # # Common: Generate Visual SlickEdit project. # !ifndef NO_VSLICKRULES !ifdef ORGTARGET vslick $(ORGTARGET).vpj: $(RM) $(ORGTARGET).vtg $(ODIN32_BASE)\tools\vslick\genproject.cmd $(CINCLUDES) $(ORGTARGET).vpj !endif !endif # # Common: General clean rule. To clean more add it to CLEANEXTRAS! # !ifndef NOCLEAN !ifndef CLEAN2 clean: !else cleandlls: clean: clean2 !endif if exist .\copying.lib ren .\copying.lib copying.lix $(RM) *.lib *.res *.map *.pch dummy.c \ !if "$(OBJDIR)" != "" $(OBJDIR)\* \ !endif !ifndef LOCALCLEAN $(ODIN32_LIB)\$(ORGTARGET).lib \ $(ORGTARGET)exp.def \ !ifndef PUBLICLIB $(ODIN32_BIN)\$(TARGET).$(TARGET_EXTENSION) *.$(TARGET_EXTENSION) \ $(ODIN32_BIN)\$(TARGET).sym *.sym \ !endif $(CLEANEXTRAS) !else $(CLEANEXTRAS) !endif if exist .\copying.lix ren .\copying.lix copying.lib !ifdef SUBDIRS @$(DODIRS) "$(SUBDIRS)" $(MAKE_CMD) clean !endif !endif # # Common: clean rule. To clean only targets, no libs/obj/def-files # !ifndef NOCLEAN !ifndef CLEAN2 cleandlls: $(RM) \ !if "$(OBJDIR)" != "" $(OBJDIR)\*.$(TARGET_EXTENSION) $(OBJDIR)\*.sym \ !endif $(ODIN32_BIN)\$(TARGET).$(TARGET_EXTENSION) *.$(TARGET_EXTENSION) \ $(ODIN32_BIN)\$(TARGET).sym *.sym @$(DODIRS) "$(SUBDIRS)" $(MAKE_CMD) cleandlls !endif !endif # # Common: Include the .depend file. # If the depend file don't exists we'll complain about it. # !ifndef NODEP ! if [$(EXISTS) .depend] == 0 ! include .depend ! else ! if [$(ECHO) .depend doesn't exist] ! endif ! endif ! if [$(EXISTS) $(ODIN32_INCLUDE)\.depend] == 0 ! include $(ODIN32_INCLUDE)\.depend ! else ! if [$(ECHO) /include/.depend doesn't exist] ! endif ! endif !endif # # Common: If MULTIJOBS is defined make sure cmdqd is running. # !ifndef NO_MULTIJOBS ! ifdef MULTIJOBS ! if [$(CMDQD) queryrunning] != 0 ! if [$(DODIRS) "$(ODIN32_BASE)\tools\cmdqd" $(MAKE_CMD) all] == 0 ! endif ! if [$(CMDQD) init 7] == 0 ! endif ! endif ! endif !endif