Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PacketLib
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Andrea Bulgarelli
PacketLib
Commits
9f34b969
Commit
9f34b969
authored
10 years ago
by
Andrea Zoli
Browse files
Options
Downloads
Patches
Plain Diff
Use conditional assignment for CXX, CFLAGS and LINK in Makefiles.
parent
a34a6ad3
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
Makefile
+4
-6
4 additions, 6 deletions
Makefile
Makefile.dist
+10
-12
10 additions, 12 deletions
Makefile.dist
examples/Makefile
+9
-12
9 additions, 12 deletions
examples/Makefile
with
23 additions
and
30 deletions
Makefile
+
4
−
6
View file @
9f34b969
...
@@ -56,11 +56,9 @@ LIB_DESTDIR = lib
...
@@ -56,11 +56,9 @@ LIB_DESTDIR = lib
####### 4) Compiler, tools and options
####### 4) Compiler, tools and options
CXX
=
g++
CXX
?
=
g++
#Insert the optional parameter to the compiler. The CFLAGS could be changed externally by the user
#Insert the optional parameter to the compiler. The CFLAGS could be changed externally by the user
#- g3
CFLAGS
?=
-O2
-fPIC
CFLAGS
=
-O2
-fPIC
-g
#-O2 -O0 -g3
#Set INCPATH to add the inclusion paths
#Set INCPATH to add the inclusion paths
INCPATH
=
-I
./include
INCPATH
=
-I
./include
#Insert the implicit parameter to the compiler:
#Insert the implicit parameter to the compiler:
...
@@ -69,7 +67,7 @@ ifeq ($(SYSTEM), QNX)
...
@@ -69,7 +67,7 @@ ifeq ($(SYSTEM), QNX)
ALL_CFLAGS
+=
-Vgcc_ntox86_gpp
-lang-c
++
ALL_CFLAGS
+=
-Vgcc_ntox86_gpp
-lang-c
++
endif
endif
#Use CPPFLAGS for the preprocessor
#Use CPPFLAGS for the preprocessor
CPPFLAGS
=
CPPFLAGS
?
=
#Set LIBS for addition library
#Set LIBS for addition library
LIBS
=
-lstdc
++
LIBS
=
-lstdc
++
ifeq
($(SYSTEM), QNX)
ifeq
($(SYSTEM), QNX)
...
@@ -81,7 +79,7 @@ ifneq (, $(findstring apple, $(SYSTEM)))
...
@@ -81,7 +79,7 @@ ifneq (, $(findstring apple, $(SYSTEM)))
LIBS
+=
-L
$(
LOCAL
)
/lib
LIBS
+=
-L
$(
LOCAL
)
/lib
endif
endif
LINK
=
g++
LINK
?=
$(
CXX
)
#for link
#for link
LFLAGS
=
-shared
-Wl
,-soname,
$(
TARGET1
)
-Wl
,-rpath,
$(
DESTDIR
)
LFLAGS
=
-shared
-Wl
,-soname,
$(
TARGET1
)
-Wl
,-rpath,
$(
DESTDIR
)
AR
=
ar cqs
AR
=
ar cqs
...
...
This diff is collapsed.
Click to expand it.
Makefile.dist
+
10
−
12
View file @
9f34b969
...
@@ -41,12 +41,10 @@ VER_FILE_NAME = PlVersion.h
...
@@ -41,12 +41,10 @@ VER_FILE_NAME = PlVersion.h
####### 4) Compiler, tools and options
####### 4) Compiler, tools and options
CC
=
gcc
CC
?
=
gcc
CXX
=
g++
CXX
?
=
g++
#Insert the optional parameter to the compiler. The CFLAGS could be changed externally by the user
#Insert the optional parameter to the compiler. The CFLAGS could be changed externally by the user
#- g3
CFLAGS
?=
-O2
CFLAGS
=
-O2
-O0
#-O2 -O0 -g3
#Set INCPATH to add the inclusion paths
#Set INCPATH to add the inclusion paths
INCPATH
=
-I
$(
includedir
)
INCPATH
=
-I
$(
includedir
)
#Insert the implicit parameter to the compiler:
#Insert the implicit parameter to the compiler:
...
@@ -61,7 +59,7 @@ LIBS = -lstdc++ -lpacket
...
@@ -61,7 +59,7 @@ LIBS = -lstdc++ -lpacket
ifeq
($(SYSTEM), QNX)
ifeq
($(SYSTEM), QNX)
LIBS
+=
-lsocket
LIBS
+=
-lsocket
endif
endif
LINK
=
g++
LINK
?=
$(
CXX
)
#for link
#for link
LFLAGS
=
-shared
-Wl
,-soname,
$(
TARGET1
)
-Wl
,-rpath,
$(
DESTDIR
)
LFLAGS
=
-shared
-Wl
,-soname,
$(
TARGET1
)
-Wl
,-rpath,
$(
DESTDIR
)
AR
=
ar cqs
AR
=
ar cqs
...
@@ -104,15 +102,15 @@ $(shell cut $(INCLUDE_DIR)/$(VER_FILE_NAME) -f 3 > version)
...
@@ -104,15 +102,15 @@ $(shell cut $(INCLUDE_DIR)/$(VER_FILE_NAME) -f 3 > version)
####### 9) Pattern rules
####### 9) Pattern rules
%.o
:
%.cpp
%.o
:
%.cpp
$(
C
C
)
$(
CPPFLAGS
)
$(
ALL_CFLAGS
)
-c
$<
-o
$(
OBJECTS_DIR
)
/
$@
$(
C
XX
)
$(
CPPFLAGS
)
$(
ALL_CFLAGS
)
-c
$<
-o
$(
OBJECTS_DIR
)
/
$@
####### 10) Build rules
####### 10) Build rules
all
:
makeobjdir $(OBJECTS)
all
:
makeobjdir $(OBJECTS)
$(
C
C
)
$(
CPPFLAGS
)
$(
ALL_CFLAGS
)
-o
$(
SOURCE_DIR
)
/in
$(
OBJECTS_DIR
)
/in.o
$(
LIBS
)
$(
C
XX
)
$(
CPPFLAGS
)
$(
ALL_CFLAGS
)
-o
$(
SOURCE_DIR
)
/in
$(
OBJECTS_DIR
)
/in.o
$(
LIBS
)
$(
C
C
)
$(
CPPFLAGS
)
$(
ALL_CFLAGS
)
-o
$(
SOURCE_DIR
)
/out
$(
OBJECTS_DIR
)
/out.o
$(
LIBS
)
$(
C
XX
)
$(
CPPFLAGS
)
$(
ALL_CFLAGS
)
-o
$(
SOURCE_DIR
)
/out
$(
OBJECTS_DIR
)
/out.o
$(
LIBS
)
$(
C
C
)
$(
CPPFLAGS
)
$(
ALL_CFLAGS
)
-o
$(
SOURCE_DIR
)
/msgqclient
$(
OBJECTS_DIR
)
/msgqclient.o
$(
LIBS
)
$(
C
XX
)
$(
CPPFLAGS
)
$(
ALL_CFLAGS
)
-o
$(
SOURCE_DIR
)
/msgqclient
$(
OBJECTS_DIR
)
/msgqclient.o
$(
LIBS
)
$(
C
C
)
$(
CPPFLAGS
)
$(
ALL_CFLAGS
)
-o
$(
SOURCE_DIR
)
/msgqserver
$(
OBJECTS_DIR
)
/msgqserver.o
$(
LIBS
)
$(
C
XX
)
$(
CPPFLAGS
)
$(
ALL_CFLAGS
)
-o
$(
SOURCE_DIR
)
/msgqserver
$(
OBJECTS_DIR
)
/msgqserver.o
$(
LIBS
)
makeobjdir
:
makeobjdir
:
test
-d
$(
OBJECTS_DIR
)
||
mkdir
-p
$(
OBJECTS_DIR
)
test
-d
$(
OBJECTS_DIR
)
||
mkdir
-p
$(
OBJECTS_DIR
)
...
...
This diff is collapsed.
Click to expand it.
examples/Makefile
+
9
−
12
View file @
9f34b969
...
@@ -41,12 +41,9 @@ VER_FILE_NAME = PlVersion.h
...
@@ -41,12 +41,9 @@ VER_FILE_NAME = PlVersion.h
####### 4) Compiler, tools and options
####### 4) Compiler, tools and options
CC
=
gcc
CXX
?=
g++
CXX
=
g++
#Insert the optional parameter to the compiler. The CFLAGS could be changed externally by the user
#Insert the optional parameter to the compiler. The CFLAGS could be changed externally by the user
#- g3
CFLAGS
?=
-O2
CFLAGS
=
-O2
-O0
#-O2 -O0 -g3
#Set INCPATH to add the inclusion paths
#Set INCPATH to add the inclusion paths
INCPATH
=
-I
$(
includedir
)
INCPATH
=
-I
$(
includedir
)
#Insert the implicit parameter to the compiler:
#Insert the implicit parameter to the compiler:
...
@@ -55,13 +52,13 @@ ifeq ($(SYSTEM), QNX)
...
@@ -55,13 +52,13 @@ ifeq ($(SYSTEM), QNX)
ALL_CFLAGS
+=
-Vgcc_ntox86_gpp
-lang-c
++
ALL_CFLAGS
+=
-Vgcc_ntox86_gpp
-lang-c
++
endif
endif
#Use CPPFLAGS for the preprocessor
#Use CPPFLAGS for the preprocessor
CPPFLAGS
=
CPPFLAGS
?
=
#Set LIBS for addition library
#Set LIBS for addition library
LIBS
=
-lstdc
++
-lpacket
LIBS
=
-lstdc
++
-lpacket
ifeq
($(SYSTEM), QNX)
ifeq
($(SYSTEM), QNX)
LIBS
+=
-lsocket
LIBS
+=
-lsocket
endif
endif
LINK
=
g++
LINK
?=
$(
CXX
)
#for link
#for link
LFLAGS
=
-shared
-Wl
,-soname,
$(
TARGET1
)
-Wl
,-rpath,
$(
DESTDIR
)
LFLAGS
=
-shared
-Wl
,-soname,
$(
TARGET1
)
-Wl
,-rpath,
$(
DESTDIR
)
AR
=
ar cqs
AR
=
ar cqs
...
@@ -104,15 +101,15 @@ $(shell cut $(INCLUDE_DIR)/$(VER_FILE_NAME) -f 3 > version)
...
@@ -104,15 +101,15 @@ $(shell cut $(INCLUDE_DIR)/$(VER_FILE_NAME) -f 3 > version)
####### 9) Pattern rules
####### 9) Pattern rules
%.o
:
%.cpp
%.o
:
%.cpp
$(
C
C
)
$(
CPPFLAGS
)
$(
ALL_CFLAGS
)
-c
$<
-o
$(
OBJECTS_DIR
)
/
$@
$(
C
XX
)
$(
CPPFLAGS
)
$(
ALL_CFLAGS
)
-c
$<
-o
$(
OBJECTS_DIR
)
/
$@
####### 10) Build rules
####### 10) Build rules
all
:
makeobjdir $(OBJECTS)
all
:
makeobjdir $(OBJECTS)
$(
C
C
)
$(
CPPFLAGS
)
$(
ALL_CFLAGS
)
-o
$(
SOURCE_DIR
)
/in
$(
OBJECTS_DIR
)
/in.o
$(
LIBS
)
$(
C
XX
)
$(
CPPFLAGS
)
$(
ALL_CFLAGS
)
-o
$(
SOURCE_DIR
)
/in
$(
OBJECTS_DIR
)
/in.o
$(
LIBS
)
$(
C
C
)
$(
CPPFLAGS
)
$(
ALL_CFLAGS
)
-o
$(
SOURCE_DIR
)
/out
$(
OBJECTS_DIR
)
/out.o
$(
LIBS
)
$(
C
XX
)
$(
CPPFLAGS
)
$(
ALL_CFLAGS
)
-o
$(
SOURCE_DIR
)
/out
$(
OBJECTS_DIR
)
/out.o
$(
LIBS
)
$(
C
C
)
$(
CPPFLAGS
)
$(
ALL_CFLAGS
)
-o
$(
SOURCE_DIR
)
/msgqclient
$(
OBJECTS_DIR
)
/msgqclient.o
$(
LIBS
)
$(
C
XX
)
$(
CPPFLAGS
)
$(
ALL_CFLAGS
)
-o
$(
SOURCE_DIR
)
/msgqclient
$(
OBJECTS_DIR
)
/msgqclient.o
$(
LIBS
)
$(
C
C
)
$(
CPPFLAGS
)
$(
ALL_CFLAGS
)
-o
$(
SOURCE_DIR
)
/msgqserver
$(
OBJECTS_DIR
)
/msgqserver.o
$(
LIBS
)
$(
C
XX
)
$(
CPPFLAGS
)
$(
ALL_CFLAGS
)
-o
$(
SOURCE_DIR
)
/msgqserver
$(
OBJECTS_DIR
)
/msgqserver.o
$(
LIBS
)
makeobjdir
:
makeobjdir
:
test
-d
$(
OBJECTS_DIR
)
||
mkdir
-p
$(
OBJECTS_DIR
)
test
-d
$(
OBJECTS_DIR
)
||
mkdir
-p
$(
OBJECTS_DIR
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment