X-Git-Url: http://git.tuebingen.mpg.de/?p=osl.git;a=blobdiff_plain;f=Makefile;h=24775a4de7c508346da2de01dfaaad44c8de8d85;hp=7d4b045e6971abc2a56d9bb8f8ae70fe94046a6d;hb=a00170132c28eeea61033d820c22e8d48d35a0fd;hpb=f065a93d3307f2065fcf8c95509166d15af4194c diff --git a/Makefile b/Makefile index 7d4b045..24775a4 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,7 @@ libdir := $(prefix)/lib includedir := $(prefix)/include objects := osl.o fd.o rbtree.o sha1.o +fsck_objects := fsck.fsck.o osl.fsck.o fd.fsck.o rbtree.fsck.o sha1.fsck.o fsck.cmdline.o headers := osl.h INSTALL := install @@ -17,6 +18,7 @@ LN := ln x := 0 y := 1 z := 0 +VERSION := $(x).$(y).$(z) # common flags CFLAGS += -Wno-sign-compare -g -Wunused -Wundef -W @@ -30,8 +32,10 @@ CFLAGS += -Werror-implicit-function-declaration CFLAGS += -Wmissing-format-attribute CFLAGS += -Wunused-macros CFLAGS += -Wbad-function-cast -CFLAGS += -fPIC -CFLAGS += -fvisibility=hidden + +# cflags used only for building library objects +LIBCFLAGS += -fPIC +LIBCFLAGS += -fvisibility=hidden uname_s := $(shell uname -s 2>/dev/null || echo "UNKNOWN_OS") uname_rs := $(shell uname -rs) @@ -86,32 +90,53 @@ ifeq ($(uname_s),SunOS) CPPFLAGS += -I/opt/csw/include endif -all: $(realname) - +all: $(realname) oslfsck Makefile.deps: $(wildcard *.c *.h) $(CC) -MM -MG *.c > $@ +osl.c fsck.c: errtab.h -include Makefile.deps +fsck.cmdline.o: fsck.cmdline.c fsck.cmdline.h + $(CC) -c -DVERSION='"$(VERSION)"' $< + +%.fsck.o: %.c Makefile fsck.cmdline.c fsck.cmdline.h + $(CC) -c -DVERSION='"$(VERSION)"' $(CPPFLAGS) $(CFLAGS) $< -o $@ + %.o: %.c Makefile - $(CC) -c $(CPPFLAGS) $(CFLAGS) $< + $(CC) -c $(CPPFLAGS) $(CFLAGS) $(LIBCFLAGS) $< + +fsck.cmdline.h fsck.cmdline.c: fsck.ggo Makefile + gengetopt $$O \ + --conf-parser \ + --unamed-opts=table \ + --no-handle-version \ + --file-name=fsck.cmdline \ + --func-name=fsck_cmdline_parser \ + --set-package="oslfsck" \ + --arg-struct-name=fsck_args_info \ + < $< + +oslfsck: $(fsck_objects) + $(CC) -o $@ $(fsck_objects) -lcrypto $(realname): $(objects) - $(CC) $(LDFLAGS) -o $@ $(objects) $(LDFLAGS) -lcrypto + $(CC) $(LDFLAGS) -o $@ $(objects) -lcrypto osl_errors.h: errlist sed -e 's/\([A-Z_]*\) .*/ E_OSL_\1/' \ -e '1s/^/enum osl_errors {/1' \ + -e '1s/$$/=1/1' \ -e '$$!s/$$/,/g' \ -e '$$s/$$/};/1' $< > $@ errtab.h: errlist sed -e 's/^\([A-Z_]*\)\s*\(.*\)/_S(E_OSL_\1, \2)/g' $< > $@ -osl.h: osl.h.in osl_errors.h - cat $^ > $@ +osl.h: osl.h.in osl_errors.h Makefile + cat osl.h.in osl_errors.h > $@ clean: - rm -f *.o $(realname) osl.h osl_errors.h errtab.h + rm -f *.o $(realname) osl.h osl_errors.h errtab.h fsck.cmdline.h fsck.cmdline.c install: all $(MKDIR) $(libdir) $(includedir)