Switch to using C++.
This commit is contained in:
parent
ca544e74fa
commit
836daeb69b
10
Makefile
10
Makefile
@ -18,8 +18,8 @@ DEBUG=0
|
||||
INCFLAGS=
|
||||
LDFLAGS=-lsqlite3
|
||||
DEFS=
|
||||
CFLAGS=$(INCFLAGS) -std=gnu99 -Wall -Wextra -Wfatal-errors -Werror
|
||||
HDRS=src/arg_parse.h src/util.h src/db.h src/cmd.h
|
||||
CFLAGS=$(INCFLAGS) -std=c++11 -Wall -Wextra -Wfatal-errors -Werror
|
||||
HDRS=src/arg_parse.hpp src/db.hpp src/cmd.hpp
|
||||
OBJS=src/main.o src/arg_parse.o src/db.o src/cmd.o
|
||||
VERSION=1.0
|
||||
|
||||
@ -33,11 +33,11 @@ else
|
||||
CFLAGS+=-O2 -DNDEBUG
|
||||
endif
|
||||
|
||||
%.o:%.c $(HDRS)
|
||||
$(CC) -c -o $@ $< $(CFLAGS) -DVERSION=\"$(VERSION)\"
|
||||
%.o:%.cpp $(HDRS)
|
||||
$(CXX) -c -o $@ $< $(CFLAGS) -DVERSION=\"$(VERSION)\"
|
||||
|
||||
menu-helper: $(OBJS)
|
||||
$(CC) -o $@ $^ $(LDFLAGS)
|
||||
$(CXX) -o $@ $^ $(LDFLAGS)
|
||||
|
||||
.PHONY: clean distclean install
|
||||
|
||||
|
@ -11,8 +11,8 @@ Ensure the `XDG_DATA_HOME` variable is set (e.g. to `$HOME/.local/share`).
|
||||
|
||||
To build the program you will require the following dependencies:
|
||||
|
||||
- A C compiler compatible with GNU99 C (preferably GCC).
|
||||
- SQLite3 C library
|
||||
- A C++ compiler compatible with GNU99 C (preferably GCC).
|
||||
- SQLite3 C/C++ library
|
||||
- Make
|
||||
|
||||
Once installed, compile the project with the `make` command.
|
||||
|
@ -15,9 +15,8 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "arg_parse.h"
|
||||
#include "arg_parse.hpp"
|
||||
|
||||
#include "util.h"
|
||||
#include <string.h>
|
||||
|
||||
enum cmd_id parse_args(const char *cmd) {
|
@ -15,8 +15,8 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "cmd.h"
|
||||
#include "db.h"
|
||||
#include "cmd.hpp"
|
||||
#include "db.hpp"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
@ -15,7 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "db.h"
|
||||
#include "db.hpp"
|
||||
|
||||
#include <sqlite3.h>
|
||||
#include <unistd.h>
|
@ -18,8 +18,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "arg_parse.h"
|
||||
#include "cmd.h"
|
||||
#include "arg_parse.hpp"
|
||||
#include "cmd.hpp"
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
enum cmd_id id;
|
20
src/util.h
20
src/util.h
@ -1,20 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024 Nicolás Ortega Froysa <nicolas@ortegas.org>
|
||||
* Nicolás Ortega Froysa <nicolas@ortegas.org>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#define ARRAY_LEN(arr) (sizeof(arr) / sizeof(arr[0]))
|
Loading…
Reference in New Issue
Block a user