From aaca10c641b54154f19e037d251d6c22fc97f417 Mon Sep 17 00:00:00 2001 From: Marko Kreen Date: Sat, 5 Jan 2013 20:45:30 +0200 Subject: [PATCH] Drop Setup.mk There are better ways to use libusual now. --- Makefile | 1 - Setup.mk | 40 -------- mk/temos/Makefile | 2 +- mk/temos/expected/libusual2.txt | 164 -------------------------------- mk/temos/expected/libusual4.txt | 1 - 5 files changed, 1 insertion(+), 207 deletions(-) delete mode 100644 Setup.mk delete mode 100644 mk/temos/expected/libusual2.txt diff --git a/Makefile b/Makefile index cd35ceb..944c208 100644 --- a/Makefile +++ b/Makefile @@ -70,7 +70,6 @@ AM_DESTINATIONS = aclocal # other files dist_pkgdata_SCRIPTS = find_modules.sh -dist_pkgdata_DATA = Setup.mk dist_aclocal_DATA = m4/usual.m4 m4/antimake.m4 # test program for link-test diff --git a/Setup.mk b/Setup.mk deleted file mode 100644 index 7549e26..0000000 --- a/Setup.mk +++ /dev/null @@ -1,40 +0,0 @@ - -# toplevel dir of libusual - always required -#req: USUAL_DIR = . -USUAL_CPPFLAGS = -I$(USUAL_DIR) - -# -# target: local objs -# - -# req: USUAL_LOCAL_SRCS or USUAL_MODULES -# opt: USUAL_OBJDIR - -# needs following rule: -#$(USUAL_OBJDIR)/%.o: $(USUAL_DIR)/usual/%.c $(USUAL_HDRS) -# $(CC) -c -o $@ $< $(DEFS) $(CPPFLAGS) $(CFLAGS) - -USUAL_OBJDIR ?= . -USUAL_HDRS = $(addprefix $(USUAL_DIR)/usual/, $(addsuffix .h, $(USUAL_MODULES))) -USUAL_SRCS = $(wildcard $(addprefix $(USUAL_DIR)/usual/, $(addsuffix *.c, $(USUAL_MODULES)))) -USUAL_OBJS = $(addprefix $(USUAL_OBJDIR)/, $(notdir $(USUAL_SRCS:.c=.o))) - -# find_modules is slow, so do immediate assignment -#USUAL_MODULES ?= $(shell $(USUAL_DIR)/find_modules.sh $(USUAL_DIR) $(USUAL_LOCAL_SRCS)) -ifeq ($(origin USUAL_MODULES),undefined) -USUAL_MODULES := $(shell $(USUAL_DIR)/find_modules.sh $(USUAL_DIR) $(wildcard $(USUAL_LOCAL_SRCS))) -endif - -# -# target: libusual.a -# - -USUAL_LIBS = -lusual -USUAL_LDFLAGS = -L$(USUAL_DIR) - -# dist files -USUAL_DIST_NOPFX = usual m4 find_modules.sh m4/usual.m4 Setup.mk README usual/config.h.in -USUAL_DIST = $(addprefix $(USUAL_DIR)/, $(USUAL_DIST_NOPFX)) -USUAL_DIST_AC_NOPFX = configure.ac configure config.mak.in -USUAL_DIST_AC = $(addprefix $(USUAL_DIR)/, $(USUAL_DIST_AC_NOPFX)) - diff --git a/mk/temos/Makefile b/mk/temos/Makefile index dc09128..60b0d4c 100644 --- a/mk/temos/Makefile +++ b/mk/temos/Makefile @@ -5,7 +5,7 @@ TEMOS = \ antimake1 antimake2 antimake3 antimake4 antimake5 antimake6 \ - libusual1 libusual2 libusual3 libusual4 libusual5 libusual6 \ + libusual1 libusual3 libusual4 libusual5 libusual6 \ diff --git a/mk/temos/expected/libusual2.txt b/mk/temos/expected/libusual2.txt deleted file mode 100644 index a3b16e0..0000000 --- a/mk/temos/expected/libusual2.txt +++ /dev/null @@ -1,164 +0,0 @@ - -= Embedding libusual as part of the source. = - - -Here we build libusual as part of top-level tree. -This gives the advantage of building only the modules -that are actually used in main tree and without the -intermediate `libusual.a` step. - -This method is for projects that are developed -in parallel with libusual. Not recommended for -casual usage. - - -== Configure libusual == - - -Here we configure libusual, but do not build it. - ---------------------------------- -$ git clone git://github.com/libusual/libusual.git lib -Cloning into 'lib'... -done. -$ cd lib -$ ./autogen.sh -[...] -$ ./configure -[...] -$ cd .. ---------------------------------- - -== Prepare own code == - - -Here is the source that needs to be linked with libusual: - -.File: prog.c -[source,c] ------------------------------------ -#include -#include -#include - -int main(void) -{ - const char *data = "CECSFXX"; - uint32_t crc; - - crc = calc_crc32(data, strlen(data), 0); - printf("crc: %08x\n", crc); - return 0; -} ------------------------------------ - -== Old way, with plain Make == - - -Here is corresponding Makefile: - -.File: Makefile -[source,makefile] ------------------------------------ -CC = gcc -CFLAGS = -O -g -Wall - -# here we describe our program -SRCS = prog.c -OBJS = $(SRCS:.c=.o) - -# here we link to libusual -USUAL_DIR = ./lib -USUAL_LOCAL_SRCS = $(SRCS) -CPPFLAGS = $(USUAL_CPPFLAGS) -OBJS += $(USUAL_OBJS) - -# this looks what modules are used by files in USUAL_LOCAL_SRCS -# and fills the USUAL_OBJS variable based on that -include $(USUAL_DIR)/Setup.mk - -all: prog - -prog: $(OBJS) - $(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) $(LIBS) -o $@ - -%.o: %.c - $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< - -# special rule to build -%.o: $(USUAL_DIR)/usual/%.c - $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< - -clean: - rm -f *.o prog ------------------------------------ - -Build the project - ---------------------------------- -$ make -gcc -O -g -Wall -I./lib -c -o prog.o prog.c -gcc -O -g -Wall -I./lib -c -o crc32.o lib/usual/hashing/crc32.c -gcc -O -g -Wall -I./lib -c -o base.o lib/usual/base.c -gcc -O -g -Wall prog.o ./crc32.o ./base.o -o prog -$ ls -Makefile base.o crc32.o lib prog prog.c prog.o -$ ./prog -crc: 12345678 -$ make clean -rm -f *.o prog -$ ls -Makefile lib prog.c ---------------------------------- - -It's quite complex and that is even without trying to get -dependencies rigth. See next section for preferred way. - - -== New way, with Antimake. == - - -Antimake is build framework on plain GNU Make that reads -build instructons with Automake syntax. It has also hooks -for libusual integration. - -Here is Makefile that uses Antimake: - -.File: Makefile -[source,makefile] ------------------------------------ -# the automake-style build description for 'prog' -noinst_PROGRAMS = prog -prog_SOURCES = prog.c - -# location of configured libusual -USUAL_DIR = lib - -# mention that 'prog' wants embedded libusual -prog_EMBED_LIBUSUAL = 1 -AM_FEATURES = libusual - -# launch Antimake -include $(USUAL_DIR)/mk/antimake.mk ------------------------------------ - -Build the project - ---------------------------------- -$ make - CC prog.c - CC lib/usual/hashing/crc32.c - CC lib/usual/base.c - CCLD prog -$ ls -Makefile lib prog prog.c -$ ./prog -crc: 12345678 -$ make clean - CLEAN prog -$ ls -Makefile lib prog.c ---------------------------------- - -Done - diff --git a/mk/temos/expected/libusual4.txt b/mk/temos/expected/libusual4.txt index fc1ec0c..3f68d56 100644 --- a/mk/temos/expected/libusual4.txt +++ b/mk/temos/expected/libusual4.txt @@ -88,7 +88,6 @@ inst/share/aclocal inst/share/aclocal/antimake.m4 inst/share/aclocal/usual.m4 inst/share/libusual -inst/share/libusual/Setup.mk inst/share/libusual/amext-libusual.mk inst/share/libusual/amext-modes.mk inst/share/libusual/antimake.mk -- 2.39.5