Skip to content

Commit

Permalink
Remove globbing from build scripts
Browse files Browse the repository at this point in the history
Globbing is generally considered a bad practice within build scripts,
be it Makefile, CMake and others. This commit, therefore, removes
globbing and uses the filenames as it should be from the beginning.
  • Loading branch information
Theldus committed Jun 29, 2021
1 parent 048b95f commit 96a92e6
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 4 deletions.
29 changes: 27 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,33 @@ include_directories(${CMAKE_SOURCE_DIR})
add_definitions(-D_GNU_SOURCE)

# Files
file(GLOB AG_SRC ag_src/*.c)
file(GLOB LIBAG_DOC doc/man3/*.3)
set(AG_SRC
ag_src/decompress.c
ag_src/ignore.c
ag_src/lang.c
ag_src/log.c
ag_src/main.c
ag_src/options.c
ag_src/print.c
ag_src/print_w32.c
ag_src/scandir.c
ag_src/search.c
ag_src/util.c
ag_src/zfile.c
)
set(LIBAG_DOC
doc/man3/ag_finish.3
doc/man3/ag_free_all_results.3
doc/man3/ag_free_result.3
doc/man3/ag_get_stats.3
doc/man3/ag_init.3
doc/man3/ag_init_config.3
doc/man3/ag_search.3
doc/man3/ag_search_ts.3
doc/man3/ag_set_config.3
doc/man3/ag_start_workers.3
doc/man3/ag_stop_workers.3
)

# libag objects
add_library(libag_objects OBJECT ${AG_SRC} libag.c)
Expand Down
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ PY_CFLAGS += -fPIC -std=c99 -D_GNU_SOURCE -MMD -O3

# Conflicts
.PHONY : all clean examples install uninstall libag.pc
.PHONY : bindings python-binding
.PHONY : bindings python-binding node-binding

# Paths
INCDIR = $(PREFIX)/include
Expand All @@ -60,7 +60,9 @@ PKGDIR = $(LIBDIR)/pkgconfig
PKGFILE = $(DESTDIR)$(PKGDIR)/libag.pc

# Sources
C_SRC = $(wildcard $(AG_SRC)/*.c) \
C_SRC = ag_src/decompress.c ag_src/ignore.c ag_src/lang.c ag_src/log.c \
ag_src/main.c ag_src/options.c ag_src/print.c ag_src/print_w32.c \
ag_src/scandir.c ag_src/search.c ag_src/util.c ag_src/zfile.c \
libag.c

# Objects
Expand Down

0 comments on commit 96a92e6

Please sign in to comment.