Skip to contentSkip to conversation

.gitignore contains .c and .h ?

Qemu-devel Guillaume Le Louët 3 participants 4 messages May 4, 2015

lore
Share & tools
lore
#0 lore raw

Hello.

The .gitignore in the master branch contains the following lines :
/qapi-types.[ch]
/qapi-visit.[ch]
/qapi-event.[ch]

Why is it so ? Are they generated automatically each time I compile the project ? I am modifying qapi-types.h and qapi-types.c , am I doing wrong ?

regards, Guillaume

#1 lore raw
Quoted 10 lines · On Mon, 04 May 2015 09:47:11 +0200 Guillaume Le Louët…

Hello.

The .gitignore in the master branch contains the following lines :
/qapi-types.[ch]
/qapi-visit.[ch]
/qapi-event.[ch]

Why is it so ? Are they generated automatically each time I compile the project ?
I am modifying qapi-types.h and qapi-types.c , am I doing wrong ?

Yes, they are created automatically and you should not edit them manually. Just have a look at the main Makefile:

qapi-modules = $(SRC_PATH)/qapi-schema.json $(SRC_PATH)/qapi/common.json \
               $(SRC_PATH)/qapi/block.json $(SRC_PATH)/qapi/block-core.json \
               $(SRC_PATH)/qapi/event.json

qapi-types.c qapi-types.h :\
$(qapi-modules) $(SRC_PATH)/scripts/qapi-types.py $(qapi-py)

        $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py \
                $(gen-out-type) -o "." -b -i $<, \
                "  GEN   $@")

So if you want to change something in this area, you likely have to touch the *.json files instead.

Thomas

#2 lore raw

You're right, I noticed that compiling with make was removing my modifications. I ended up modifying the qapi-schema.json .

May I advise to move the generated .c and .h files into a generated/ folder ?

Thank you Thomas.

Quoted 30 lines · Thomas Huth
Quoted 10 lines · On Mon, 04 May 2015 09:47:11 +0200 Guillaume Le Louët…

Hello.

The .gitignore in the master branch contains the following lines :
/qapi-types.[ch]
/qapi-visit.[ch]
/qapi-event.[ch]

Why is it so ? Are they generated automatically each time I compile the project ?
I am modifying qapi-types.h and qapi-types.c , am I doing wrong ?

Yes, they are created automatically and you should not edit them manually. Just have a look at the main Makefile:

qapi-modules = $(SRC_PATH)/qapi-schema.json $(SRC_PATH)/qapi/common.json \
                $(SRC_PATH)/qapi/block.json $(SRC_PATH)/qapi/block-core.json \
                $(SRC_PATH)/qapi/event.json

qapi-types.c qapi-types.h :\
$(qapi-modules) $(SRC_PATH)/scripts/qapi-types.py $(qapi-py)

         $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py \
                 $(gen-out-type) -o "." -b -i $<, \
                 "  GEN   $@")

So if you want to change something in this area, you likely have to touch the *.json files instead.

Thomas

#3 lore raw
Quoted 6 lines · Guillaume Le Louët

You're right, I noticed that compiling with make was removing my modifications.
I ended up modifying the qapi-schema.json .

May I advise to move the generated .c and .h files into a generated/ folder ?

If you want to keep generated files out of your source tree
I would recommend using a separate build tree:
mkdir build/whatever && (cd build/whatever && ../../configure [args here]) make -C build/whatever

(You'll need to distclean your tree first if you've been doing in-source-tree builds.)

-- PMM