What is this makefile?

I am new to make files and I have some make files. One of them has these statements, which I tried to understand, but I can’t.

What does this make file do?

# debugging support
ifeq ($(DEBUG), true)
CFLAGS+=-DDEBUG -g
endif 

ifeq ($(DEBUG), gdb)
CFLAGS+=-g
endif

ifeq ($(PROFILING), true)
CFLAGS+=-p
endif

# symbolic names debugging
ifeq ($(DEBUG_NAMES), true)
CFLAGS+=-DDEBUG_NAMES
endif 

# architecture TODO: add others
ifeq ($(ARCH), unix)
CFLAGS+=-DUNIX
endif

# TODO: GC settings
ifeq ($(HEAP), malloc)
CFLAGS+=-DHEAP_MALLOC
endif

ifeq ($(STACK), malloc)
CFLAGS+=-DSTACK_MALLOC
endif

# class loading method
ifeq ($(CLASS), external)
CFLAGS+=-DEXTERNAL_TUK
endif

# monitor allocation
ifeq ($(MONITORS), ondemand)
CFLAGS+=-DON_DEMAND_MONITORS
endif

Amri

+3
source share
3 answers

Essentially, the makefile does a bunch of checks and adds compiler flags based on the state of certain variables. For instance:

ifeq ($(DEBUG), true)

CFLAGS+=-DDEBUG -g

endif

If the DEBUG $ (DEBUG) variable is set to true, then define the DEBUG macro and set the compiler to output debug binaries (-g).

Each other statement looks approximately the same.

+6
source

This checks the values ​​of the environment variables and sets up the build process with certain parameters for the compiler (I think).

+5
source

CFLAGS - , C. .

, , C. :

man cc
man gcc
cc --help
gcc --help
+2

All Articles