# requires lua, curl and zlib (in the future, lua will be statically linked) libraries := -llua -lcurl -lz flags := -Wall # lua is required in the build process, in order to compile the bytecode lua := lua cc := gcc dst_dir = dst src_main_dir = src/main src_entry_dir = src/entry # Uncomment to get debugging symbols # flags := -g main_sources += $(wildcard $(src_main_dir)/*.lua) main_sources += $(wildcard $(src_main_dir)/cli/*.lua) main_sources += $(wildcard $(src_main_dir)/formats/*.lua) main_sources += $(wildcard $(src_main_dir)/util/*.lua) c_sources = $(wildcard $(src_entry_dir)/*.c) build_entry = $(src_entry_dir)/build.lua target = $(dst_dir)/slimpack bytecode_target = $(dst_dir)/bytecode.h .PHONY: build build: $(target) $(dst_dir): mkdir -p $@ $(bytecode_target): $(main_sources) $(dst_dir) $(build_entry) $(lua) $(build_entry) $(src_main_dir) $@ $(main_sources) $(target): $(c_sources) $(bytecode_target) $(dst_dir) $(cc) $(flags) $(libraries) -include $(bytecode_target) $(c_sources) -o $@