xref: /illumos-gate/usr/src/lib/libsqlite/Makefile.targ (revision 9b9d39d2a32ff806d2431dbcc50968ef1e6d46b2)
1#
2# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
3# Use is subject to license terms.
4# Copyright 2015 Igor Kozhukhov <ikozhukhov@gmail.com>
5# Copyright 2016 Nexenta Systems, Inc.  All rights reserved.
6# Copyright (c) 2019, Joyent, Inc.
7# Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
8#
9
10opcodes.h: $(SRCDIR)/vdbe.c
11	@echo "Generating $@"; \
12	$(RM) -f $@ ; \
13	echo '/* Automatically generated file.  Do not edit */' > $@ ; \
14	$(GREP) '^case OP_' $(SRCDIR)/vdbe.c | \
15	    $(SED) -e 's/://' | \
16	    $(AWK) '{printf "#define %-30s %3d\n", $$2, ++cnt}' >> $@
17
18opcodes.c: $(SRCDIR)/vdbe.c
19	@echo "Generating $@"; \
20	$(RM) -f $@ ; \
21	$(ECHO) '/* Automatically generated file.  Do not edit */' > $@ ; \
22	$(ECHO) 'char *sqliteOpcodeNames[] = { "???", ' >> $@ ; \
23	$(GREP) '^case OP_' $(SRCDIR)/vdbe.c | \
24	    $(SED) -e 's/^.*OP_/  "/' -e 's/:.*$$/", /' >> $@ ; \
25	 $(ECHO) '};' >> $@
26
27testfixture: FRC
28	@if [ -f $(TCLBASE)/include/tcl.h ]; then \
29		unset SUNPRO_DEPENDENCIES; \
30		$(ECHO) $(LINK.c) -o testfixture $(TESTSRC) $(LIBRARY) $(LDLIBS) ;\
31		exec $(LINK.c) -o testfixture $(TESTSRC) $(LIBRARY) $(LDLIBS) ;\
32	else \
33		$(ECHO) "$(TCLBASE)/include/tcl.h: not found."; \
34		exit 1; \
35	fi
36
37# Prevent Makefile.lib $(PICS) := from adding PICFLAGS
38# by building lemon in a recursive make invocation.
39# Otherwise, this target causes a rebuild every time after
40# the PICS target builds this one way, then lint the other.
41parse.h parse.c : $(SRCDIR)/parse.y $(TOOLDIR)/lemon.c $(TOOLDIR)/lempar.c
42	-$(RM) parse_tmp.y lempar.c
43	$(CP) $(SRCDIR)/parse.y parse_tmp.y
44	$(CP) $(TOOLDIR)/lempar.c lempar.c
45	$(MAKE) lemon
46	./lemon parse_tmp.y
47	-$(RM) parse.c parse.h
48	$(CP) parse_tmp.h parse.h
49	$(CP) parse_tmp.c parse.c
50
51lemon: $(TOOLDIR)/lemon.c
52	$(NATIVECC) $(NATIVE_CFLAGS) -o $@ $(TOOLDIR)/lemon.c
53
54objs/%.o pics/%.o: $(SRCDIR)/%.c $(GENHDR)
55	$(COMPILE.c) -o $@ $<
56	$(POST_PROCESS_O)
57
58objs/%.o pics/%.o: %.c $(GENHDR)
59	$(COMPILE.c) -o $@ $<
60	$(POST_PROCESS_O)
61
62# need direct rules for generated files
63objs/opcodes.o pics/opcodes.o: opcodes.c $(GENHDR)
64	$(COMPILE.c) -o $@ opcodes.c
65	$(POST_PROCESS_O)
66
67objs/parse.o pics/parse.o: parse.c $(GENHDR)
68	$(COMPILE.c) -o $@ parse.c
69	$(POST_PROCESS_O)
70
71include $(SRC)/lib/Makefile.targ
72