Skip to content

Commit

Permalink
add ZSV_EXTRAS definition to zsv.h (#183)
Browse files Browse the repository at this point in the history
  • Loading branch information
liquidaty authored Aug 1, 2024
1 parent 9f54b5c commit dff43ea
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
2 changes: 2 additions & 0 deletions include/zsv.h → include/zsv.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#ifndef ZSV_H
#define ZSV_H

__ZSV_EXTRAS__DEFINE__

#include <stddef.h>
#include "zsv/common.h"
#include "zsv/api.h"
Expand Down
15 changes: 12 additions & 3 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ help:
@echo " [CONFIGFILE=config.mk] [NO_UTF8_CHECK=1] [VERBOSE=1] [LIBDIR=${LIBDIR}] [INCLUDEDIR=${INCLUDEDIR}] [LIB_SUFFIX=]"
@echo

build: ${LIBZSV}
build: ../include/zsv.h ${LIBZSV}

${LIBZSV}: ${ZSV_OBJ}
@mkdir -p `dirname "$@"`
Expand All @@ -131,9 +131,17 @@ ${LIBZSV}: ${ZSV_OBJ}
$(AR) -t $@ # check it is there
@echo Built $@

install: ${LIBZSV_INSTALL}
../include/zsv.h:
ifeq ($(ZSV_EXTRAS),1)
@sed 's/__ZSV_EXTRAS__DEFINE__/#ifndef ZSV_EXTRAS\n#define ZSV_EXTRAS\n#endif/' < ../include/zsv.h.in > $@
else
@sed 's/__ZSV_EXTRAS__DEFINE__//' < ../include/zsv.h.in > $@
endif

install: ../include/zsv.h ${LIBZSV_INSTALL}
@mkdir -p $(INCLUDEDIR)
@cp -pR ../include/* $(INCLUDEDIR)
@cp -p ../include/*.h $(INCLUDEDIR)
@cp -pR ../include/zsv $(INCLUDEDIR)/
@echo "include files copied to $(INCLUDEDIR)"

${LIBZSV_INSTALL}: ${LIBZSV}
Expand All @@ -147,6 +155,7 @@ uninstall:

clean:
rm -rf ${BUILD_DIR}/objs ${LIBZSV}
rm -f ../include/zsv.h

.PHONY: build install uninstall clean ${LIBZSV_INSTALL}

Expand Down

0 comments on commit dff43ea

Please sign in to comment.