Did you know ... | Search Documentation: |
Compiling a foreign extension using a simple Makefile |
If the package requires some C code to be compiled that has no
dependencies and needs no configuration it is probably easiest to use a
simple Unix make file. We assume pack_version(2)
. Here is a
simple Makefile
. We assume the pack contains a file
c/environ.c
that contains the C source. Following the GNU
guidelines, the Makefile
must define the following targets:
distclean
target is used by pack_rebuild/1.MODULE= $(SWIPL_MODULE_DIR)/environ.$(SOEXT) CFLAGS= $(SWIPL_CFLAGS) all: $(MODULE) OBJ=c/environ.o $(MODULE): $(OBJ) mkdir -p $(SWIPL_MODULE_DIR) $(SWIPL_LD) $(SWIPL_MODULE_LDFLAGS) -o $@ $(OBJ) $(SWIPL_MODULE_LIB) check:: $(SWIPL) -g run_tests -t halt test/test_environ.pl install:: clean: rm -f $(OBJ) distclean: clean rm -f $(MODULE)