Search code examples
opensslnmake

What does it mean install argument of NMake


All,Forgive me post some confuse here hope to get some help for better understanding.

I am trying to compile the OpenSSL src in the VS 2012. Everything walked through well. But just have some confused which is

  1. running the commands nmake -f ms\ntdll.mak and nmake -f ms\ntdll.mak install.

In my understanding . -f means refer to a makefile. install means a target.

  1. What is the target of makefile?

My understanding is just a set of dos command to be executed. I can see code in the ntdll.mak.

install: all
    $(MKDIR) "$(INSTALLTOP)"
    $(MKDIR) "$(INSTALLTOP)\bin"
    $(MKDIR) "$(INSTALLTOP)\include"
    $(MKDIR) "$(INSTALLTOP)\include\openssl"
    $(MKDIR) "$(INSTALLTOP)\lib"
    $(CP) "$(INCO_D)\*.[ch]" "$(INSTALLTOP)\include\openssl"
    $(CP) "$(BIN_D)\$(E_EXE).exe $(INSTALLTOP)\bin"
    $(MKDIR) "$(OPENSSLDIR)"
    $(CP) apps\openssl.cnf "$(OPENSSLDIR)"
    $(CP) "$(O_SSL)" "$(INSTALLTOP)\bin"
    $(CP) "$(O_CRYPTO)" "$(INSTALLTOP)\bin"
    $(CP) "$(L_SSL)" "$(INSTALLTOP)\lib"
    $(CP) "$(L_CRYPTO)" "$(INSTALLTOP)\lib"
    $(MKDIR) "$(INSTALLTOP)\lib\engines"
    $(CP) "$(E_SHLIB)" "$(INSTALLTOP)\lib\engines"



test: $(T_EXE)
    cd $(BIN_D)
    ..\ms\test
  1. why run nmake twice? my understanding previous one is just build. second one is build for a installation package like msietc. Thanks.

Solution

  • Yes your understanding is correct.

    1. -f flag tells it to use the following file as the Makefile

    2. The target of the makefile is either the parameter given to make or the first target in the makefile (which is often all).

    3. Why run it twice: as you surmised, the first call of make builds the software in a working directory and the second copies the result of the build to the install location using the sequence of DOS commands given below the target label.

      All of these details are generic to any variant of the make program and not specific to Microsoft's nmake. You have not asked anything specific about nmake.