Permalink
Browse files

task #4270 using short notation, using GNUmakefile notdir, and making…

… sure that $<

will reference the right file by making explicit %.c->%.o rule.
  • Loading branch information...
jgrammenos authored and mcr committed Jul 27, 2015
1 parent b9833d0 commit dfc857a43f055292cd2df0052eb359a022a203e5
@@ -1,3 +1,4 @@
# -*- makefile -*-
# some files have issues with cpp, and need -Wno-error=cpp, but only for
# newer versions of gcc.
# Check if GCC's version is recent enough
@@ -16,7 +17,7 @@ endif
ifeq ($(V),1)
${CC} -c ${CFLAGS} $<
else
@echo CC `basename $<`
@echo CC $(notdir $<)
@${CC} -c ${CFLAGS} $<
endif
@@ -6,7 +6,8 @@ SOURCE=saref.c
TARGET=libsaref.so
${TARGET}: ${SOURCE}
$(CC) ${CFLAGS} -fPIC -o $@ -shared -ldl ${SOURCE}
@echo CC $(notdir $<)
@$(CC) ${CFLAGS} -fPIC -o $@ -shared -ldl ${SOURCE}
.PHONY: clean
clean:
@@ -53,7 +53,8 @@ MIX_OBJS := $(filter $(export-objs), $(active-objs))
include $(TOPDIR)/Rules.make
$(obj-y): $(HDRS)
@echo CC $(notdir $<)
@$(CC) -c $(CFLAGS) $(CPPFLAGS) -o $@ $<
# build version.c using version number from Makefile.ver
version.c: version.in.c
sed '/"/s/@IPSECVERSION@/$(IPSECVERSION)/' version.in.c >$@
@@ -103,6 +103,10 @@ $(LIB): $(OBJS)
$(OBJS): $(HDRS)
%.o: %.c
@echo CC $(notdir $<)
@$(CC) -c $(CFLAGS) $(CPPFLAGS) -o $@ $<
cleanall::
rm -rf ${OBJS} $(LIB)
@@ -27,7 +27,7 @@ TEST=bftest.c
APPS=
LIB=$(TOP)/libcrypto.a
LIBSRC=bf_skey.c bf_ecb.c bf_enc.c bf_cfb64.c bf_ofb64.c
LIBSRC=bf_skey.c bf_ecb.c bf_enc.c bf_cfb64.c bf_ofb64.c
LIBOBJ=bf_skey.o bf_ecb.o $(BF_ENC) bf_cfb64.o bf_ofb64.o
SRC= $(LIBSRC)
@@ -43,8 +43,9 @@ top:
all: lib
lib: $(LIBOBJ)
$(AR) $(LIB) $(LIBOBJ)
$(RANLIB) $(LIB)
@echo AR $(notdir $<)
@$(AR) $(LIB) $(LIBOBJ)
@$(RANLIB) $(LIB)
@touch lib
# elf
@@ -53,17 +54,20 @@ asm/bx86-elf.o: asm/bx86unix.cpp
# solaris
asm/bx86-sol.o: asm/bx86unix.cpp
$(CC) -E -DSOL asm/bx86unix.cpp | sed 's/^#.*//' > asm/bx86-sol.s
@echo CC $(notdir $<)
@$(CC) -E -DSOL asm/bx86unix.cpp | sed 's/^#.*//' > asm/bx86-sol.s
as -o asm/bx86-sol.o asm/bx86-sol.s
rm -f asm/bx86-sol.s
# a.out
asm/bx86-out.o: asm/bx86unix.cpp
$(CPP) -DOUT asm/bx86unix.cpp | as -o asm/bx86-out.o
@echo CPP $(notdir $<)
@$(CPP) -DOUT asm/bx86unix.cpp | as -o asm/bx86-out.o
# bsdi
asm/bx86bsdi.o: asm/bx86unix.cpp
$(CPP) -DBSDI asm/bx86unix.cpp | sed 's/ :/:/' | as -o asm/bx86bsdi.o
@echo CPP $(notdir $<)
@$(CPP) -DBSDI asm/bx86unix.cpp | sed 's/ :/:/' | as -o asm/bx86bsdi.o
asm/bx86unix.cpp: asm/bf-586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl
(cd asm; $(PERL) bf-586.pl cpp $(PROCESSOR) >bx86unix.cpp)
@@ -53,7 +53,8 @@ SRCS += time.c key.c lib.c
programs all: ${LIB}.a
version.o: version.c
${LIBTOOL} --mode=compile ${CC} ${ALL_CFLAGS} \
@echo LIBTOOL $(notdir $<)
@${LIBTOOL} --mode=compile ${CC} ${ALL_CFLAGS} \
-DVERSION=\"${VERSION}\" \
-DLIBINTERFACE=${LIBINTERFACE} \
-DLIBREVISION=${LIBREVISION} \
@@ -62,7 +63,8 @@ version.o: version.c
-c ${srcdir}/version.c
${LIB}.a: ${OBJS} version.o
${AR} ${ARFLAGS} $@ ${OBJS} version.o
@echo AR $(notdir $<)
@${AR} ${ARFLAGS} $@ ${OBJS} version.o
timestamp: ${LIB}.a
touch timestamp
@@ -77,8 +79,9 @@ TAGS: ${SRCS}
etags ${SRCS}
rdata.o: code.h
@echo CC $(notdir $<)
name.o: ${HDRS}
@echo CC $(notdir $<)
include/dns/enumtype.h: gen
mkdir -p include/dns
./gen -s ${srcdir} -t > $@
@@ -102,5 +105,6 @@ code.h: gen
# cross-compiled!
HOSTCC?=cc
gen: gen.c
${HOSTCC} ${HOSTCINCLUDES} ${LDFLAGS} -o $@ ${srcdir}gen.c ${LIBS}
@echo HOSTCC $(notdir $<)
@${HOSTCC} ${HOSTCINCLUDES} ${LDFLAGS} -o $@ ${srcdir}gen.c ${LIBS}
@@ -55,10 +55,12 @@ include ${srcdir}../Makefile.library
keywords.c: parser.tab.h
lex.yy.c: parser.tab.c parser.l parser.y
$(LEX) ${srcdir}parser.l
@echo LEX $(notdir $<)
@$(LEX) ${srcdir}parser.l
parser.tab.h parser.tab.c: parser.l parser.y
$(BISON) ${BISONOSFLAGS} -v -d ${srcdir}parser.y
@echo BISON $(notdir $<)
@$(BISON) ${BISONOSFLAGS} -v -d ${srcdir}parser.y
cleanall::
$(RM) -f parser.tab.* lex.yy.*
@@ -77,10 +77,15 @@ install_file_list:
done
$(LIB): $(OBJS)
$(AR) $(ARFLAGS) $(LIB) $(OBJS)
@echo AR $(notdir $<)
@$(AR) $(ARFLAGS) $(LIB) $(OBJS)
$(OBJS): $(HDRS)
%.o: %.c
@echo CC $(notdir $<)
@$(CC) -c $(CFLAGS) $(CPPFLAGS) -o $@ $<
# build version.c using version number from Makefile.ver
version.c: version.in.c ${OPENSWANSRCDIR}/Makefile.ver
sed '/"/s/@IPSECVERSION@/$(IPSECVERSION)/' ${OPENSWANSRCDIR}/lib/libipsecpolicy/version.in.c >$@
@@ -48,9 +48,10 @@ SRCS += task.c event.c errno2result.c strerror.c
SRCS += rwlock.c random.c inet_aton.c inet_ntop.c
programs all: ${LIB}.a
@echo CC `basename $<`
version.o: version.c
${LIBTOOL} --mode=compile ${CC} ${ALL_CFLAGS} \
@echo CC $(notdir $<)
@${LIBTOOL} --mode=compile ${CC} ${ALL_CFLAGS} \
-DVERSION=\"${VERSION}\" \
-DLIBINTERFACE=${LIBINTERFACE} \
-DLIBREVISION=${LIBREVISION} \
@@ -59,7 +60,8 @@ version.o: version.c
-c ${srcdir}version.c
${LIB}.a: ${OBJS} version.o
${AR} ${ARFLAGS} $@ ${OBJS} version.o
@echo CC $(notdir $<)
@${AR} ${ARFLAGS} $@ ${OBJS} version.o
timestamp: ${LIB}.a
touch timestamp
@@ -82,19 +82,22 @@ TARGETS = timestamp
@BIND9_MAKE_RULES@
version.@O@: version.c
${LIBTOOL_MODE_COMPILE} ${CC} ${ALL_CFLAGS} \
@echo CC $(notdir $<)
@${LIBTOOL_MODE_COMPILE} ${CC} ${ALL_CFLAGS} \
-DVERSION=\"${VERSION}\" \
-DLIBINTERFACE=${LIBINTERFACE} \
-DLIBREVISION=${LIBREVISION} \
-DLIBAGE=${LIBAGE} \
-c ${srcdir}/version.c
libisc.@SA@: ${OBJS}
${AR} ${ARFLAGS} $@ ${OBJS}
${RANLIB} $@
@echo AR $(notdir $<)
@${AR} ${ARFLAGS} $@ ${OBJS}
@${RANLIB} $@
libisc.la: ${OBJS}
${LIBTOOL_MODE_LINK} \
@echo CC $(notdir $<)
@${LIBTOOL_MODE_LINK} \
${CC} ${ALL_CFLAGS} ${LDFLAGS} -o libisc.la -rpath ${libdir} \
-version-info ${LIBINTERFACE}:${LIBREVISION}:${LIBAGE} \
${OBJS} ${LIBS}
@@ -103,10 +106,12 @@ timestamp: libisc.@A@
touch timestamp
installdirs:
$(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${libdir}
@echo CC `basename $<`
@$(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${libdir}
install:: timestamp installdirs
${LIBTOOL_MODE_INSTALL} ${INSTALL_DATA} libisc.@A@ ${DESTDIR}${libdir}
@echo CC `basename $<`
@${LIBTOOL_MODE_INSTALL} ${INSTALL_DATA} libisc.@A@ ${DESTDIR}${libdir}
clean distclean::
rm -f libisc.@A@ libisc.la timestamp
@@ -55,7 +55,8 @@ ONEFILE=async.c
all: programs
version.o: version.c
${LIBTOOL} --mode=compile ${CC} ${CFLAGS} \
@echo LIBTOOL $(notdir $<)
@${LIBTOOL} --mode=compile ${CC} ${CFLAGS} \
-DVERSION=\"${VERSION}\" \
-DLIBINTERFACE=${LIBINTERFACE} \
-DLIBREVISION=${LIBREVISION} \
@@ -68,6 +69,10 @@ timestamp: liblwres.a
$(OBJS): $(HDRS)
%.o: %.c
@echo CC $(notdir $<)
@$(CC) -c $(CFLAGS) $(CPPFLAGS) -o $@ $<
check:
echo no checks in lib right now.
@@ -171,6 +171,10 @@ $(LIBA): $(OBJS)
$(OBJS): $(HDRS)
%.o: %.c
@echo CC $(notdir $<)
@$(CC) -c $(CFLAGS) $(CPPFLAGS) -o $@ $<
# build version.c using version number from Makefile.ver
version.c: version.in.c ${OPENSWANSRCDIR}/Makefile.ver
@echo VERSION processing ${IPSECVERSION}
@@ -106,10 +106,16 @@ install_file_list:
done
$(LIB): $(OBJS)
$(AR) $(ARFLAGS) $(LIB) $(OBJS)
@echo AR $(notdir $<)
@$(AR) $(ARFLAGS) $(LIB) $(OBJS)
$(OBJS): $(HDRS)
%.o: %.c
@echo CC $(notdir $<)
@$(CC) -c $(CFLAGS) $(CPPFLAGS) -o $@ $<
cleanall:
rm -rf ${OBJS} $(LIB)
@@ -11,8 +11,9 @@ AES_OBJS := ipsec_alg_aes.o $(LIBCRYPTO)/libaes/libaes.a
$(MOD_AES): $(AES_OBJS)
$(LD) $(EXTRA_LDFLAGS) -r $(AES_OBJS) -o $@
@echo LD `basename $<`
@$(LD) $(EXTRA_LDFLAGS) -r $(AES_OBJS) -o $@
$(LIBCRYPTO)/libaes/libaes.a:
$(MAKE) -C $(LIBCRYPTO)/libaes CC='$(CC)' 'ARCH_ASM=$(ARCH_ASM)' CFLAGS='$(CFLAGS) $(EXTRA_CFLAGS)' libaes.a
@$(MAKE) -C $(LIBCRYPTO)/libaes CC='$(CC)' 'ARCH_ASM=$(ARCH_ASM)' CFLAGS='$(CFLAGS) $(EXTRA_CFLAGS)' libaes.a
@@ -11,4 +11,5 @@ endif
CRYPTOAPI_OBJS := ipsec_alg_cryptoapi.o
$(MOD_CRYPTOAPI): $(CRYPTOAPI_OBJS)
$(LD) -r $(CRYPTOAPI_OBJS) -o $@
@echo LD ${MOD_CRYPTOAPI}
@$(LD) -r $(CRYPTOAPI_OBJS) -o $@
@@ -200,7 +200,8 @@ LDLIBS=${LIBS} ${USERLINK} ${LIBS} ${EXTRALIBS} ${LIBGMP} ${NSS_LIBS} ${FIPS_LIB
include ${OPENSWANSRCDIR}/programs/Makefile.manpages
%.i: %.c
$(CC) $(CFLAGS) -E -o $@ $<
@echo CC $(notdir $<)
@$(CC) $(CFLAGS) -E -o $@ $<
TRANSFORM_VARIABLES = sed -e "s:@IPSECVERSION@:$(IPSECVERSION):" \
-e "s:@IPSEC_DIR@:$(FINALBINDIR):" \
@@ -221,13 +222,13 @@ TRANSFORM_VARIABLES = sed -e "s:@IPSECVERSION@:$(IPSECVERSION):" \
%: ${srcdir}%.in ${OPENSWANSRCDIR}/Makefile.inc ${OPENSWANSRCDIR}/Makefile.ver
@echo 'IN' `basename $<` '->' $@
@echo 'IN' $(notdir $<) '->' $@
@${TRANSFORM_VARIABLES} < $< > $@
@if [ -x $< ]; then chmod +x $@; fi
@if [ "${PROGRAM}.in" = $< ]; then chmod +x $@; fi
%: ${srcdir}%.pl ${OPENSWANSRCDIR}/Makefile.inc ${OPENSWANSRCDIR}/Makefile.ver
@echo 'PL' `basename $<` '->' $@
@echo 'PL' $(notdir $<) '->' $@
@${TRANSFORM_VARIABLES} < $< > $@
@if [ -x $< ]; then chmod +x $@; fi
@if [ "${PROGRAM}.pl" = $< ]; then chmod +x $@; fi
@@ -268,15 +268,16 @@ check:
checkprograms:
.c.o:
@echo CC `basename $<`
@echo CC $(notdir $<)
@$(CC) $(USERCOMPILE) ${PORTINCLUDE} $(COPTS) $(ALLFLAGS) -c $<
%.s: %.c
@echo CC-TO-AS `basename $<`
@echo CC-TO-AS $(notdir $<)
@$(CC) -S $(USERCOMPILE) ${PORTINCLUDE} $(COPTS) $(ALLFLAGS) -c $<
%.i: %.c
$(CC) $(USERCOMPILE) ${PORTINCLUDE} $(COPTS) $(ALLFLAGS) -E -o $@ $<
@echo CC $(notdir $<)
@$(CC) $(USERCOMPILE) ${PORTINCLUDE} $(COPTS) $(ALLFLAGS) -E -o $@ $<
# Gather dependencies caused by explicit #includes within .c files
@@ -1,8 +1,10 @@
# -*- makefile -*-
ALG:=aes
CONFIG_YES:=$(CONFIG_IKE_ALG_AES)
ALG_SRCS-$(CONFIG_YES) := $(ALG_SRCS-$(CONFIG_YES)) ike_alg_$(ALG).c
ALG_OBJS-$(CONFIG_YES) := $(ALG_OBJS-$(CONFIG_YES)) ike_alg_$(ALG).o
ike_alg_$(ALG).o: ike_alg_$(ALG).c
$(CC) $(COPTS) $(ALLFLAGS) -c $<
@echo CC $(notdir $<)
@$(CC) $(COPTS) $(ALLFLAGS) -c $<
@@ -1,3 +1,5 @@
# -*- makefile -*-
ALG:=blowfish
CONFIG_YES:=$(CONFIG_IKE_ALG_BLOWFISH)
DIR_BLOWFISH:=$(LIBCRYPTO)/libblowfish
@@ -10,4 +12,5 @@ $(DIR_BLOWFISH)/libblowfish.a:
make -C $(DIR_BLOWFISH) CFLAGS="$(CFLAGS)" libblowfish.a
ike_alg_$(ALG).o: ike_alg_$(ALG).c
$(CC) -I $(LIBCRYPTO) -I$(DIR_BLOWFISH) $(COPTS) $(ALLFLAGS) -c $<
@echo CC $(notdir $<)
@$(CC) -I $(LIBCRYPTO) -I$(DIR_BLOWFISH) $(COPTS) $(ALLFLAGS) -c $<
@@ -1,3 +1,5 @@
# -*- makefile -*-
ALG:=serpent
CONFIG_YES:=$(CONFIG_IKE_ALG_SERPENT)
DIR_SERPENT:=$(LIBCRYPTO)/libserpent
@@ -10,4 +12,5 @@ $(DIR_SERPENT)/libserpent.a:
make -C $(DIR_SERPENT) CFLAGS="$(CFLAGS)" libserpent.a
ike_alg_$(ALG).o: ike_alg_$(ALG).c
$(CC) -I $(LIBCRYPTO) -I$(DIR_SERPENT) $(COPTS) $(ALLFLAGS) -c $<
@echo CC $(notdir $<)
@$(CC) -I $(LIBCRYPTO) -I$(DIR_SERPENT) $(COPTS) $(ALLFLAGS) -c $<
@@ -1,3 +1,5 @@
# -*- makefile -*-
ALG:=sha2
CONFIG_YES:=$(CONFIG_IKE_ALG_SHA2)
DIR_SHA2:=$(LIBCRYPTO)/libsha2
@@ -10,4 +12,5 @@ $(DIR_SHA2)/libsha2.a:
make -C $(DIR_SHA2) libsha2.a
ike_alg_$(ALG).o: ike_alg_$(ALG).c
$(CC) -I $(LIBCRYPTO) -I$(DIR_SHA2) $(COPTS) $(ALLFLAGS) -c $<
@echo CC $(notdir $<)
@$(CC) -I $(LIBCRYPTO) -I$(DIR_SHA2) $(COPTS) $(ALLFLAGS) -c $<
Oops, something went wrong.

0 comments on commit dfc857a

Please sign in to comment.