Mixed compilation Makefile of C + + + finally completely debug

Source: Internet
Author: User
Tags mixed
#########################################################################
#name: RTP Makefile v.1.2
#date: 2006 05 30
#written By:chen Yulin
#usage: Make Clean
# Make OBJS
# Make Libs
# Make vSERVER
# Make Vclient
# make All
#libneed: LIBJRTP libjthread
##########################################################################

cc=gcc
cxx=g++

Sdllibs = $ (Shell sdl-config--libs)
Sdlflags = $ (Shell sdl-config--cflags)

servflags=-o2-dlinux
Math_lib=-lm
Servlibs= $ (math_lib)-LPTHREAD-LJRTP

incl =-i/usr/local/include/jrtplib3-i/. -i/usr/include/sdl-i/usr/local/include/jthread

Cflags =-duse_sdl-o2-dlinux $ (sdlflags)-pipe-o2-fno-strength-reduce
Cxxflags =-duse_sdl-o2-dlinux $ (sdlflags)-lpthread-pipe-o2-fno-strength-reduce

Ldflags =-ljrtp-l/usr/x11r6/lib-ljpgenc-ljpgdec-l./-static-ljthread-lpthread
Lflags =-lpthread-l/usr/x11r6/lib-ljpgenc-ljpgdec-lsdl-l.//usr/local/lib/libjrtp.a/usr/local/lib/libjthread.a
#编译SDL库的时候不能做静态联接-static, specify the address of the library you want to use directly


objects= c.o utils.o tcputils.o encoder.o huffman.o marker.o quant.o PICTURE.O

objserver= s.o v4l.o utils.o tcputils.o encoder.o huffman.o marker.o QUANT.O

Lib_encode = LIBJPGENC.A
Lib_encode_object = V4L.O tcputils.o utils.o encoder.o huffman.o marker.o quant.o jdatatype.h

Lib_decode = LIBJPGDEC.A
Lib_decode_object = utils.o encoder.o huffman.o marker.o quant.o picture.o jdatatype.h

All:vserver vclient

OBJS:V4L.O utils.o tcputils.o encoder.o huffman.o marker.o quant.o PICTURE.O

Libs:libjpgenc Libjpgdec

Clean
@echo "Cleaning up directory."
Rm-f *.a *.o ser vserver vclient core *~ log *.jpg *.bak



Vclient: $ (OBJECTS)
$ (CXX) $ (cxxflags)-O vclient $ (OBJECTS) $ (math_lib) $ (sdllibs) $ (lflags)

VSERVER: $ (objserver)
# g++-i/usr/local/include/jrtplib3-i/usr/local/include/jthread-l/usr/local/lib-o ser s.cpp libjpgenc.a-lpthread -lm-dlinux-ljrtp-ljthread
$ (CXX) $ (servflags)-O vserver $ (objserver) $ (servlibs) $ (ldflags)


Libjpgenc: $ (lib_encode_object)
Ar-cur $ (Lib_encode) $ (lib_encode_object)//Custom library joins

Libjpgdec: $ (lib_decode_object)
Ar-cur $ (Lib_decode) $ (lib_decode_object)



#只编译不链接
C.o:c.cpp jconfig.h Utils.h
$ (CXX)-C $ (cxxflags) $ (sdllibs) $ (incl) $ (math_lib)-O $@
S.o:s.cpp
$ (CXX)-c-pipe-o2-fno-strength-reduce $ (incl)-o $@ $<
# g++-c-pipe-o2-fno-strength-reduce-i/usr/local/include/jrtplib3-i/usr/local/include/jthread-o S.O s.cpp



V4L.O:V4L.C v4l.h
$ (CC) $ (servflags)-c-o $@ $<

UTILS.O:UTILS.C Utils.h
$ (CC) $ (servflags)-c-o $@ $<


TCPUTILS.O:TCPUTILS.C Tcputils.h
$ (CC) $ (servflags)-c-o $@ $<

ENCODER.O:ENCODER.C Encoder.h
$ (CC) $ (servflags)-c-o $@ $<

HUFFMAN.O:HUFFMAN.C Huffman.h
$ (CC) $ (servflags)-c-o $@ $<

MARKER.O:MARKER.C Marker.h
$ (CC) $ (servflags)-c-o $@ $<

Quant.o:quant.c quant.h
$ (CC) $ (servflags)-c-o $@ $<

Picture.o:picture.c picture.h
$ (CC) $ (servflags)-c-o $@ $<

Modify the header file that is called by the CPP function and add the following:
#ifdef __cplusplus
extern "C" {
#endif
..............

#ifdef __cplusplus
}
#endif

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.