1- NAME := advanced-library-search
2- TARGET = all
3- SRCZIP := source-code.zip
1+ # Makefile for Advanced Library Search Firefox Extension
42
5- .PHONY : build clean build-all build-chrome build-firefox source-code
3+ # --- Variables ---
64
7- build : build-$(TARGET )
5+ # Output filename for the packaged extension
6+ TARGET = advanced-library-search.zip
7+ # You can use .xpi if you prefer, Firefox accepts both for temporary loading
8+ # TARGET = advanced-library-search.xpi
89
9- build-all : build-firefox build-chrome
10+ # Source files and directories to include in the package
11+ SOURCES = manifest.json index.html css/ js/ icons/
1012
11- build-firefox :
12- @cd ./dist && \
13- zip -r ../$(NAME ) .xpi icons js index.html manifest.json
13+ # --- Targets ---
1414
15- build-chrome :
16- zip -r $( NAME ) .zip dist
15+ # Default target: build the extension
16+ all : build
1717
18- # for source code submission for firefox
19- source-code :
20- zip -r $(SRCZIP ) ./src ./package.json ./tsconfig.json ./webpack.config.js
18+ # Build the extension package (zip file)
19+ # -r: Recurse into directories
20+ # -FS: Sync filesystem contents (useful for reproducibility if files change)
21+ # -9: Use highest compression level
22+ build : $(TARGET )
2123
24+ # zip option -x Exclude OS specific hidden files
25+ $(TARGET ) : $(SOURCES )
26+ @echo " Packaging extension into $( TARGET) ..."
27+ @# Ensure the target directory exists if needed (not strictly needed here)
28+ @# mkdir -p $(dir $(TARGET))
29+ @# Using zip command to create the archive
30+ @zip -r -FS $(TARGET ) $(SOURCES ) -x ' *.DS_Store' -x ' *._*'
31+ @echo " Extension packaged successfully: $( TARGET) "
32+
33+ # Clean up the build artifact
2234clean :
23- rm -rf ./dist ./node_modules $(SRCZIP ) $(NAME ) .zip $(NAME ) .xpi
35+ @echo " Cleaning up build artifacts..."
36+ @rm -f $(TARGET )
37+ @echo " Cleanup complete."
38+
39+ # Declare targets that are not actual files
40+ .PHONY : all build clean
0 commit comments