Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 705 Vote(s) - 3.53 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Is a makefile basically the same thing as a batch file?

#1
I know all about batch files and made them before, but I'm unclear on what a makefile is. It looks like a batch file. What are the similarities and diffferences?
Reply

#2
No. A makefile has special rules which relate how files depend on each other. It does not necessarily execute in the order it is written.

A batch file is a sequence of commands and control statements.

Makefiles often contain the same things as batch files, but batch files do not have a direct way of indicating dependencies or provide an inferred method of processing one kind of file into another kind.
Reply

#3
Very interesting question. With a shell script or batch file, you are providing your computer with a list of instructions to follow in order. It starts at the top, works down until it reaches the end, and then stops. OK, there might be function definitions, loops and gotos which change the exact order in which things happen, but largely speaking the progress through the file is linear.

Makefiles, on the other hand, provide a series of instructions on how to make certain things from certain other things. When you call `make`, you tell it what you want, and it analyses the instructions which it has and decides which of them it needs to execute in order to make your specified target. As a result, what happens when you call a makefile depends not just on the content of the file itself, but on what you asked it to make and what state your files are in at that point.

Two different approaches for doing two different things.
Reply

#4
Makefiles list commands which are executed, but they're structured differently than a list of sequential commands. Instead they have targets and the commands to 'make' them. `make` then checks the listed dependencies and sees what targets it needs to update to make what you told it to. There are many implicit rules (given an *.c file make already knows how to compile it to an *.o and even build an executable!) and standard variables (e.g. CFLAGS) so you can use this to your advantage. And, contrary to the man page, you can use these implicit rules without a `Makefile`.

The simplest way to think about it is the makefile says *how* to make an 'A' given a 'B', and then you tell make *what* you want to do (e.g. `make all`) rather than how to do it. It figures out the individual steps.

- [GNU make reference](

[To see links please register here]

)


Reply

#5
Not at all. They're similar in the sense that all programming languages are similar (even more so since they're both scripting), but they have very different purposes.

The **purpose** of makefiles is to describe how to build a project. This usually means creating rules (in a special language) that say things like:

1. whenever you see a file that ends in .c, run the program "gcc" on it to compile it into a ".o" object file.
2. whenever you have a bunch of ".o"s, link them into a ".exe".

Of course this is a simplistic description.

**The main benefit** of using make (the "interpreter" for the makefile language) is that you get a syntax which is purpose-built for these kinds of things. For example, make usually takes care of things like checking whether a file has changed, so that you don't compile a file that doesn't have any changes.
Reply

#6
Makefiles are data for the Make program. Think of them as what the old guys did before they had XML :)
Reply

#7
To put a fairly abstract spin on it:

* Batch files are written in a imperative language.
* Makefiles are written in a declarative language for file processing (which is intended for and usually used for build control).
Reply

#8
### Similar, yes, except for the dependencies, the topological sort, the macro processing, and the expert system ###
If you do nothing but put shell commands in a *Makefile* then it is in fact a lot like a catalog of "batch files," and it executes each one when its associated named *target* is specified.

However, it is more typical to specify a graph of *dependencies* in a makefile, in which case *make* does a ***[topological sort][1]*** of all the dependencies in order to cleverly build everything only once and in the right order starting with the earliest prerequisites.

And to be complete, I should add that *make* is also a macro processor. It's oriented towards software build systems, so it provides handles on symbolic elements in its problem domain, such as the names of sources and targets.

Now, make is not *specifically* a general purpose expert system,<sup>1</sup> but it does do more than just package up shellcode, and technically it does fit the expert system definition.

Make contains an ***[inference engine][2]***. All versions of make have ***[suffix rules][3]***, some versions also implement ***[pattern rules][4]***. When combined with your specification (more rules, typically ones defining a software application) the result is an ***[expert system][5]*** which will decide what needs to be compiled, linked, purchased on [***eBay***][6], whatever, all depending on the data and commands you have provided.
<hr>
<sup>1. It's an *easy-to-use* expert system, instead. Skynet will probably not emerge from an accidental typo in a complicated Makefile.</sup>

[1]:

[To see links please register here]

[2]:

[To see links please register here]

[3]:

[To see links please register here]

[4]:

[To see links please register here]

[5]:

[To see links please register here]

[6]:

[To see links please register here]

Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through