summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLouie S <louie@example.com>2024-06-07 15:10:52 -0400
committerLouie S <louie@example.com>2024-06-07 15:10:52 -0400
commit603d3105cb16470e502f0e3d20f95d2243771e33 (patch)
tree2d775cf0fd4df3e745ff1649d5e1119e13416113
parenta9413e16e8a8d160acb760a0971f25ef23d71e8c (diff)
Replace placeholders with wildcard rules
-rw-r--r--Makefile10
-rw-r--r--README.md10
-rw-r--r--src/scripts/create_table.sh7
-rw-r--r--src/scripts/insert.sh8
4 files changed, 29 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index dc6ed0c..ca465f0 100644
--- a/Makefile
+++ b/Makefile
@@ -20,10 +20,8 @@ clean:
.phony: GNU_Make
GNU_Make: $(BUILD_DIR)/GNU_Make.docset
-# All docset files should be listed here
-$(BUILD_DIR)/GNU_Make.docset:
- $(SRC_MAKE_CALL) DOCSET_NAME=GNU_Make
+$(BUILD_DIR)/%.docset:
+ $(SRC_MAKE_CALL) DOCSET_NAME=$(basename $(@F))
-# All archive files should be listed here
-$(BUILD_DIR)/GNU_Make.tgz: GNU_Make
- tar --exclude='.DS_Store' -czf $@ $(BUILD_DIR)/GNU_Make.docset
+$(BUILD_DIR)/%.tgz: $(BUILD_DIR)/%.docset
+ tar --exclude='.DS_Store' -czf $@ $(basename $@).docset
diff --git a/README.md b/README.md
index ed9bd59..366b689 100644
--- a/README.md
+++ b/README.md
@@ -16,3 +16,13 @@ Other possible targets:
$(BUILD_DIR)/$(DOCSET_NAME).docset - equivalent to DOCSET_NAME
$(BUILD_DIR)/$(DOCSET_NAME).tgz - create a .tgz archive of DOCSET_NAME
```
+
+### Project Structure
+
+```
+.
+├── src
+│   ├── configs - supported docsets, including metadata and build scripts
+│   └── scripts - general purpose scripts
+└── tmp - intermediate sources (e.g., upstream sources are downloaded to here)
+```
diff --git a/src/scripts/create_table.sh b/src/scripts/create_table.sh
new file mode 100644
index 0000000..a783c50
--- /dev/null
+++ b/src/scripts/create_table.sh
@@ -0,0 +1,7 @@
+create_table() {
+ DB_PATH="$1"
+
+ sqlite3 "$DB_PATH" "CREATE TABLE IF NOT EXISTS searchIndex(id INTEGER PRIMARY KEY, name TEXT, type TEXT, path TEXT);"
+ sqlite3 "$DB_PATH" "CREATE UNIQUE INDEX IF NOT EXISTS anchor ON searchIndex (name, type, path);"
+}
+
diff --git a/src/scripts/insert.sh b/src/scripts/insert.sh
new file mode 100644
index 0000000..31c1b4c
--- /dev/null
+++ b/src/scripts/insert.sh
@@ -0,0 +1,8 @@
+insert() {
+ DB_PATH="$1"
+ NAME="$2"
+ TYPE="$3"
+ PAGE_PATH="$4"
+
+ sqlite3 "$DB_PATH" "INSERT INTO searchIndex(name, type, path) VALUES (\"$NAME\",\"$TYPE\",\"$PAGE_PATH\");"
+}