General Dynamics (GD 0.03%) stock has had an odd couple of years, gaining more than 17% in 2017 but still lagging most of its defense rivals. Interest in defense stocks, including General Dynamics, has ebbed in recent months, but the company still trades at a discount to some of its chief rivals.

Is there upside for General Dynamics from here, or is the stock set to slowly erase its gains from 2017 as investors turn their attention away from defense and toward other sectors? Here's a breakdown of what is driving General Dynamics' businesses to determine whether or not the shares are a buy today.

Abrams tank firing in desert setting

A General Dynamics-built M1 Abrams tank in action. Image source: General Dynamics.

Defense keeps chugging along

General Dynamics is a manufacturer of a range of different weapons systems and has been among the top beneficiaries of the ongoing Pentagon spending surge following the budget compromise reached earlier this year. The company sees the potential for increased orders in the quarters to come, with the Department of Defense and Congress committed to funding increased purchases of General Dynamics-built submarines and Stryker ground vehicles, among other programs.

First-quarter operating earnings for its combat systems unit were up 9.3% year over year on 11.9% higher revenue. Similarly, General Dynamics' marine systems business saw operating income climb 14% from last year on revenue that was 5.2% higher. The company ended the quarter with a total backlog of $62.1 billion.

General Dynamics is also in the process of integrating its $9.6 billion acquisition of CSRA, a deal that more than doubled its government IT presence at a time when federal demand for IT services is expected to surge. The CSRA business is currently involved in a number of large contract competitions, most notably a series of bids on the Army's $13.77 billion Warfighter Focus program, which, if successful, could move the needle in the quarters to come.

Commercial strain

Defense is humming, but the arm of General Dynamics not catering to the Pentagon continues to struggle. General Dynamics is parent of Gulfstream, a major player in a business jet market that has so far failed to recover from the 2008-2009 recession. Global sales of business jets are less than half of what they were in 2008, and that has eaten into Gulfstream results and caused the unit to act like an anchor on General Dynamics' otherwise strong performance.

There has been some reason to believe the business jet industry is pulling out of its tailspin, but Gulfstream did little to ease investor concerns in the first quarter. General Dynamics reported a book-to-bill ratio for its aerospace unit of just 0.77, down from 1.3 in the fourth quarter of 2017. Gulfstream also delayed initial deliveries of its G500 midsize jet from the current quarter to the last four months of the year.

On May 27, Gulfstream rival Bombardier signaled a belief in a revitalized business jet market, saying it would build two new large-cabin jets in response to growing demand. There's good news for General Dynamics in that assessment. To some extent, a rising tide will lift all boats, and Gulfstream should benefit from increasing sales should the market recover.

The bad news is these new jets will likely be more formidable competition for the forthcoming Gulfstream 500 and 600 series. Using a new engine from Rolls-Royce and a modified wing design, the Bombardier jets should have a range that beats the new Gulfstream models while closing an existing gap on max speed.

The Bombardier jets also will not appear until the fourth quarter of 2019, assuming the programs arrive on schedule, meaning that Gulfstream will have a substantial lead if it meets its current goal of delivering the 500 before year's end and the 600 in early 2019. Gulfstream also has a solid initial order book of more than 50 planes for each of its new jets, so the Bombardier announcement should not derail a Gulfstream recovery. It will mean more difficult competition for new orders in the years that follow.

Is General Dynamics a buy?

After a long run of gains, defense stocks are in the doldrums right now as investors weigh mounting global threats, growing foreign weapons sales, and an increased Pentagon budget against the talk of a North Korea peace deal and the election-year danger of a fall budget battle or even a government shutdown. Shares of General Dynamics are down 8% over the last three months but are still up 46% over the past three years.

The concerns are justified, and with valuations near 10-year highs, it's no surprise that investors are not rushing in to bid defense stocks higher. Still, for long-term shareholders the outlook for aerospace and defense spending remains strong. And General Dynamics, with a price-to-earnings ratio of 21, continues to trade at a discount to rivals Northrop Grumman (27), Raytheon (28), and Lockheed Martin (38).

That discount is because of Gulfstream, not due to any management weakness or structural issues at General Dynamics. I continue to believe that as the business jet market stabilizes, the valuation gap will close. And that makes General Dynamics the best buy among defense primes.