Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
P
Programmable RF Attenuator
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
Programmable RF Attenuator
Commits
c85e516c
Commit
c85e516c
authored
Mar 13, 2024
by
Dimitris Lampridis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sw: make Makefile more standard
parent
2870732e
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
74 additions
and
58 deletions
+74
-58
Makefile
software/Makefile
+1
-1
Makefile
software/lib/Makefile
+71
-14
Makefile.ftdi
software/lib/Makefile.ftdi
+0
-18
Makefile.install
software/lib/Makefile.install
+0
-19
setup.py
software/lib/setup.py
+2
-6
No files found.
software/Makefile
View file @
c85e516c
...
...
@@ -2,5 +2,5 @@
#
# SPDX-License-Identifier: LGPL-2.1-or-later
all clean
:
all
install
clean
:
make
-C
lib
$@
software/lib/Makefile
View file @
c85e516c
...
...
@@ -4,34 +4,91 @@
-include
Makefile.ftdi
OBJS
=
$(LIBNAME)
.o usb-enum.o eeprom.o
CFLAGS
+=
-fPIC
-g
CFLAGS
+=
-DGIT_VERSION
=
\"
$(GIT_VERSION)
\"
GIT_VERSION
=
$(
shell
git describe
--dirty
--tags
--long
)
GIT_VERSION
=
$(
shell
git describe
--dirty
--long
--tags
--always
|
tr
-d
"v"
)
VER_MAJOR
=
$
(
word 1,
$
(
subst ., ,
$(GIT_VERSION)
))
VER_MINOR
=
$
(
word 2,
$
(
subst ., ,
$(GIT_VERSION)
))
VER_PATCH
=
$
(
word 1,
$
(
subst -, ,
$
(
word 3,
$
(
subst ., ,
$(GIT_VERSION)
))))
VERSION
=
$(VER_MAJOR)
.
$(VER_MINOR)
.
$(VER_PATCH)
SO_VERSION_XYZ
=
$(VERSION)
SO_VERSION_X
=
$(VER_MAJOR)
ifeq
($(SO_VERSION_X),)
SO_VERSION_X
:=
0
endif
DESTDIR
?=
prefix
?=
/usr/local
exec_prefix
?=
$(prefix)
bindir
?=
$(exec_prefix)
/bin
libdir
?=
$(exec_prefix)
/lib
includedir
?=
$(prefix)
/include
pythondir
?=
$(libdir)
/python
NAME
=
oattnusb
BINNAME
=
$(NAME)
test
LIBNAME
=
lib
$(NAME)
LIBSO
=
$(LIBNAME)
.so
LIBSO_XYZ
=
$(LIBSO)
.
$(SO_VERSION_XYZ)
LIBSO_X
=
$(LIBSO)
.
$(SO_VERSION_X)
LIB
=
$(LIBNAME)
.a
LOBJ
=
$(LIBNAME)
.o usb-enum.o eeprom.o
CFLAGS
+=
-Wall
-Werror
-fPIC
-g
CFLAGS
+=
-DGIT_VERSION
=
\"
$(GIT_VERSION)
\"
CFLAGS
+=
$(EXTRACFLAGS)
ARFLAGS
=
rcv
# intra2net does not seem to settle into any side of this
# dilemma, so we have to decide for them, see
# http://developer.intra2net.com/mailarchive/html/libftdi/2013/msg00372.html
#
LIBFTDI_CONFIG
=
$(
shell
command
-v
libftdi1-config
)
ifeq
($(LIBFTDI_CONFIG),)
LIBFTDI_CONFIG
=
$(
shell
command
-v
libftdi-config
)
endif
LIBFTDI_INC
:=
$(
shell
$(LIBFTDI_CONFIG)
--cflags
)
LIBFTDI_LIBS
:=
$(
shell
$(LIBFTDI_CONFIG)
--libs
)
CFLAGS
+=
$(LIBFTDI_INC)
LDLIBS
+=
$(LIBFTDI_LIBS)
LDLIBS
+=
-ludev
CPPCHECK
?=
cppcheck
all
:
lib doc
lib
:
$(LIBNAME).a $(LIBNAME).so
all
:
lib doc
lib
:
$(LIB) $(LIBSO) $(LIBSO_XYZ)
$(LIBNAME).a
:
$(OBJS)
ar rc
$(LIBNAME)
.a
$(OBJS)
$(LIBNAME).so
:
LDLIBS += -ludev
$(LIBNAME).so
:
$(OBJS)
$(CC)
$(CFLAGS)
-shared
-o
$@
$^
$(LDFLAGS)
$(LDLIBS)
$(OBJS)
:
$(LIBNAME).h $(LIBNAME)-i.h usb-enum.h
$(LIB)
:
$(LOBJ)
$(AR)
$(ARFLAGS)
$@
$^
$(LIBSO_XYZ)
:
$(LOBJ)
$(CC)
-shared
$^
-Wl
,-soname,
$(LIBSO_X)
-o
$@
$(LDFLAGS)
$(LDLIBS)
$(LIBSO)
:
$(LIBSO_XYZ)
ln
-sf
$<
$@
doc
:
doxygen oattn.doxy
clean
:
rm
-f
*
.a
*
.o
*
.so
rm
-f
$(LIB)
$(LIBSO)
$(LIBSO_XYZ)
$(LOBJ)
.depend
*
.a
*
.o
*
.so
*
*
~
rm
-rf
html
rm
-rf
build pyoattnusb.egg-info
cppcheck
:
$(CPPCHECK)
-I
.
*
.c
*
.h
--error-exitcode
=
1
--suppress
=
missingIncludeSystem
\
--enable
=
warning,style,performance,portability,information,missingInclude
-include
Makefile.install
deploy deploy-$(LIBNAME)
:
install
install
:
$(LIBSO) $(LIBSO_XYZ) $(LIB)
mkdir
-m
0775
-p
$(DESTDIR)
{
$(libdir)
,
$(includedir)
,
$(pythondir)
,
$(bindir)
}
install
-D
-t
$(DESTDIR)$(libdir)
-m
0755
$(LIBSO_XYZ)
install
-D
-t
$(DESTDIR)$(libdir)
-m
0644
$(LIB)
install
-D
-t
$(DESTDIR)$(includedir)
-m
0644
$(LIBNAME)
.h usb-enum.h
cp
-d
$(LIBSO)
$(DESTDIR)$(libdir)
install
-D
-t
$(DESTDIR)$(bindir)
-m
0755
$(BINNAME)
VERSION
=
$(VERSION)
pip
install
.
--target
$(DESTDIR)$(pythondir)
.PHONY
:
install
software/lib/Makefile.ftdi
deleted
100644 → 0
View file @
2870732e
# SPDX-FileCopyrightText: 2023 CERN (home.cern)
#
# SPDX-License-Identifier: LGPL-2.1-or-later
#
# intra2net does not seem to settle into any side of this
# dilemma, so we have to decide for them, see
# http://developer.intra2net.com/mailarchive/html/libftdi/2013/msg00372.html
#
CONFIG
=
$(
shell
which libftdi1-config
)
ifeq
($(CONFIG),)
CONFIG
=
$(
shell
which libftdi-config
)
endif
LIBFTDI_INC
:=
$(
shell
$(CONFIG)
--cflags
)
LIBFTDI_LIBS
:=
$(
shell
$(CONFIG)
--libs
)
CFLAGS
+=
$(LIBFTDI_INC)
LDLIBS
+=
$(LIBFTDI_LIBS)
software/lib/Makefile.install
deleted
100644 → 0
View file @
2870732e
# SPDX-FileCopyrightText: 2023 CERN (home.cern)
#
# SPDX-License-Identifier: LGPL-2.1-or-later
VERSION
=
$(
shell
git describe
--dirty
--tags
--long
)
OATTN_ROOT
=
/acc/local/L867/drv/
$(NAME)
INSTALL_ROOT
=
$(OATTN_ROOT)
/
$(VERSION)
install
:
$(LIBNAME).a $(LIBNAME).so $(NAME)test
install
:
$(LIBNAME).h usb-enum.h
install
:
mkdir
-p
$(INSTALL_ROOT)
/lib
mkdir
-p
$(INSTALL_ROOT)
/include
mkdir
-p
$(INSTALL_ROOT)
/bin
ln
-sf
.
$(INSTALL_ROOT)
/include/
$(NAME)
install
-m
0775
$(LIBNAME)
.a
$(LIBNAME)
.so
$(INSTALL_ROOT)
/lib
install
-m
0775
$(NAME)
test
$(INSTALL_ROOT)
/bin
install
-m
0775
$(LIBNAME)
.h usb-enum.h
$(INSTALL_ROOT)
/include
pip
install
.
--target
$(INSTALL_ROOT)
/lib
software/lib/setup.py
View file @
c85e516c
...
...
@@ -3,16 +3,12 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
from
setuptools
import
setup
,
find_packages
import
subprocess
try
:
version
=
subprocess
.
check_output
([
'git'
,
'describe'
,
'--tags'
])
.
decode
()
.
strip
()
except
Exception
:
version
=
'0.0.0'
import
os
setup
(
name
=
'pyoattnusb'
,
version
=
version
,
version
=
os
.
environ
.
get
(
'VERSION'
,
"0.0.0"
)
,
packages
=
find_packages
(),
author
=
'Dimitris Lampridis'
,
author_email
=
'dimitris.lampridis@cern.ch'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment