mirror of
https://git.proxmox.com/git/libgit2
synced 2026-01-06 22:15:58 +00:00
Make using CFLAGS a bit simpler
This patch introduces the $(ALL_CFLAGS) variable, which holds $(BASIC_CFLAGS) as well as userdefined $(CFLAGS) and then consistently uses that variable where both were used anyway. Since we're in the area, we optimize the sparse running a bit, getting rid of the shell and just letting sparse iterate over the files. Signed-off-by: Andreas Ericsson <ae@op5.se> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
This commit is contained in:
parent
6013ffa66e
commit
ab3f234e5f
7
Makefile
7
Makefile
@ -7,6 +7,7 @@ OS = unix
|
||||
|
||||
BASIC_CFLAGS := -Isrc
|
||||
BASIC_CFLAGS += -fvisibility=hidden
|
||||
ALL_CFLAGS = $(CFLAGS) $(BASIC_CFLAGS)
|
||||
|
||||
SRC_C = $(wildcard src/*.c)
|
||||
OBJS = $(patsubst %.c,%.o,$(SRC_C))
|
||||
@ -42,14 +43,14 @@ apidocs:
|
||||
test: $(TEST_RUN)
|
||||
|
||||
sparse: $(CONFIG_H)
|
||||
@for i in $(SRC_C); do sparse $$i -DSPARSE_IS_RUNNING $(SPARSE_FLAGS) $(BASIC_CFLAGS) $(CFLAGS); done
|
||||
sparse -DSPARSE_IS_RUNNING $(ALL_CFLAGS) $(SPARSE_FLAGS) $(SRC_C)
|
||||
|
||||
install-headers: $(PUBLIC_HEADERS)
|
||||
@mkdir -p /tmp/gitinc/git
|
||||
@for i in $^; do cat .HEADER $$i > /tmp/gitinc/$${i##src/}; done
|
||||
|
||||
.c.o:
|
||||
$(CC) $(BASIC_CFLAGS) $(CFLAGS) -c $< -o $@
|
||||
$(CC) $(ALL_CFLAGS) -c $< -o $@
|
||||
|
||||
$(CONFIG_H): $(CONFIG_H).in
|
||||
sed 's/@@OS@@/$(OS)/g' $< >$@+
|
||||
@ -72,7 +73,7 @@ $(patsubst %.exe,%.toc,$(TEST_EXE)): tests/%.toc: tests/%.c
|
||||
mv $@+ $@
|
||||
|
||||
$(TEST_OBJ): tests/%.o: tests/%.c
|
||||
$(CC) -Isrc $(CFLAGS) -c $< -o $@
|
||||
$(CC) $(ALL_CFLAGS) -c $< -o $@
|
||||
|
||||
$(patsubst %.exe,%_main.o,$(TEST_EXE)): tests/%_main.o: $(HDRS)
|
||||
$(patsubst %.exe,%_main.o,$(TEST_EXE)): tests/%_main.o: $(T_MAIN_C)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user